vue 錯誤集


[Vue warn]: You are setting a non-existent path "answer" on a vm instance. Consider pre-initializing the property with the "data" option for more reliable reactivity and better performance.

說明:使用的變量“answer”沒有初始化,需要再data里聲明聲明。

 

[Vue warn]: Attributes "class", ":transition" are ignored on component <router-view> because the component is a fragment instance: http://vuejs.org/guide/components.html#Fragment-Instance

官方說,出現實例片段的原因如下:

  1. Template contains multiple top-level elements. (模版包涵了多個頂級元素 說白了 你的模版元素沒有唯一一個父元素)
  2. Template contains only plain text.(模版里面只包涵純文本)
  3. Template contains only another component (which can potentially be a fragment instance itself).(模版只包含另外一個組件,而這個組件本上可以就是一個fragment instance)
  4. Template contains only an element directive, e.g. <partial> or vue-router’s<router-view>.(模版只包含<partial>或者<router-view>組件 )
  5. Template root node has a flow-control directive, e.g. v-if or v-for.(模版根節點被v-if活着v-for有個邏輯判斷)
1、模板包含多個頂級元素。
2、模板只包含普通文本。
3、模板只包含其它組件(其它組件可能是一個片段實例)。
4、模板只包含一個元素指令,如 或 vue-router 的 。
5、模板根節點有一個流程控制指令,如 v-if 或 v-for。

 

[Vue warn]: Error when evaluating expression "function (vm) {

        return getter(vm.state);

      }": Error: [vuex] Do not mutate vuex store state outside mutation handlers.

 原因:在mutation外改變了state
export const avatar = (state) => {
state.user.avatar = appUser.avatar
return state.user.avatar
}
正確寫法:
export const avatar = (state) => {
return state.user.avatar
}

Uncaught TypeError: Cannot read property '__v_trans' of null

說明: 這個vm實例沒有指定el掛載點

 

 

[vue-router] Uncaught error during transition:

Uncaught TypeError: (0 , _dealHelper.getcStrategy) is not a function

原因:

router: {

    data () {

        //這里的代碼出錯

   }

}

Uncaught Error: no content is found

我使用了vux的scroller,在scroller中做了個循環創建dom,如果沒有創建的話就會報這個錯誤,可見,在scroller至少應該包含一個容器.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM