久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      vue.js循環(huán)引用組件報(bào)錯(cuò)怎么辦

      vue.js解決循環(huán)引用組件報(bào)錯(cuò)的方法:首先打開項(xiàng)目,使用全局引入組件;然后在vue實(shí)例化前,在【main.js】里引入,代碼為【import selFile from './views/file/selFile.vue'】。

      vue.js循環(huán)引用組件報(bào)錯(cuò)怎么辦

      【相關(guān)文章推薦:vue.js】

      vue.js解決循環(huán)引用組件報(bào)錯(cuò)的方法:

      問題由來

      最近在做項(xiàng)目的時(shí)候遇到使用循環(huán)組件,因?yàn)槟J揭粯?,只有?shù)據(jù)不一樣。按照普通組件調(diào)用格式來做的時(shí)候總是報(bào)錯(cuò),錯(cuò)誤信息為[Vue warn]: Unknown custom element: <selfile> – did you register the component correctly? For recursive components, make sure to provide the "name" option.

      解決方案

      查詢了網(wǎng)上各種資料之后,發(fā)現(xiàn)是循環(huán)調(diào)用組件時(shí),組件比vue實(shí)例后創(chuàng)建,官方文檔里寫組件必須先于實(shí)例化引入,所以說組件沒有正確的引入。

      解決方式

      解決的方式就是全局引入組件,并且在vue實(shí)例化前。

      具體到我們項(xiàng)目中,就是在main.js里引入。

      具體代碼如下main.js:

      import Vue from 'vue' import App from './App' import router from './router' import store from './store'; import iView from 'iview'; import './styles/index.less' import {VTable,VPagination} from 'vue-easytable' import 'vue-easytable/libs/themes-base/index.css' import Axios from './utils/axiosPlugin' import './styles/button.css' import './styles/common.css' // require('./mock/mock') import selFile from './views/file/selFile.vue'   Vue.use(iView); Vue.use(Axios);   Vue.component(VTable.name, VTable) Vue.component(VPagination.name, VPagination) Vue.component("selFile",selFile)   Vue.config.productionTip = false   /* eslint-disable no-new */ new Vue({  el: '#app',  store,  router,  components: { App },  template: '<App/>' })

      用上面的方法全局引入組件就可以解決循環(huán)引用組件報(bào)錯(cuò)的問題。

      相關(guān)免費(fèi)學(xué)習(xí)推薦:javascript(視頻)

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)