【备忘录】Vue2.0组件props

export default {
    props: ['options'],
    data() {
      return {
      }
    }
}

提示:[Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop's value. Prop being mutated: "options" (found in component )

需要改为:

export default {
    props: ['myOptions'],
    data() {
      return {
        options: this.myOptions
      }
    }
}

来调用options

posted @ 2017-10-10 15:59  xiaoroad  阅读(140)  评论(0编辑  收藏  举报