Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store.js中使用Vue.set的用处是什么 #254

Open
tryCatch99073 opened this issue Jul 21, 2019 · 1 comment
Open

store.js中使用Vue.set的用处是什么 #254

tryCatch99073 opened this issue Jul 21, 2019 · 1 comment

Comments

@tryCatch99073
Copy link

请问在官方文档的数据预取和状态中,store.js中使用Vue.set的用处是什么

 mutations: {
      setItem (state, { id, item }) {
        Vue.set(state.items, id, item)
      }
    }
@yuanhuanwebfront
Copy link

这个只是为了修改对象内的某个属性,Vue 不能检测对象属性的添加或删除:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants