分类 Front End 下的文章

Using Object.assign

Update:
This method has a flaw that it only does a shallow copy. It
means that nested properties are still going to be copied by
reference.

Be careful about it.

这也是我亲自踩坑之后才搜索到的。

原文:http://michaelnthiessen.com/force-re-render/
标题: The correct way to force Vue to re-render a component

The best way to force Vue to re-render a component is to set a :key on the component. When you need the component to be re-rendered, you just change the value of the key and Vue will re-render the component.

  • The horrible way: reloading the entire page
  • The terrible way: using the v-if hack
  • The better way: using Vue’s built-in forceUpdate method
  • The best way: key-changing on your component

If you look at https://cli.vuejs.org/guide/cli-service.html it tells you that after installing @vue/cli-service ( which may be part of the standard CLI installation ) then vue-cli-service is available in npm scripts, but that if you want to access it directly then you need to use ./node_modules/.bin/vue-cli-service This worked for me, and I guess you could add ./node_modules/.bin to your $PATH if you were so inclined.

- 阅读剩余部分 -