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至少应该包含一个容器.

posted @ 2016-10-28 11:18  v以恒  阅读(2520)  评论(0编辑  收藏  举报