Ily*_* Vo 0 vue.js vuejs2 nuxt.js
我将在Nuxtjs应用程序中通过Vue.set()设置属性。
editPost(post) {
Vue.$set(post, 'edit', true)
}
Run Code Online (Sandbox Code Playgroud)
得到错误:未定义Vue
您可以使用this
代替Vue.
。这引用了方法内部的当前vue组件,因此它将以相同的方式工作:
editPost(post) {
this.$set(post, 'edit', true)
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
750 次 |
最近记录: |