摘要:
vue使用v-for时vscode报错 Elements in iteration expect to have 'v-bind:key' directives
Vue 2.2.0+的版本里,当在组件中使用v-for时,key是必须的
错误提示:
[vue-language-server] Elements in iteration expect to have 'v-bind:key' directives.
Renders the element or template block multiple times based on the source data
原因是eslint检测出现bug
解决方法:
1.在v-for 后添加 :key='item'
阅读全文
摘要:
vue获得当前页面URL动态拼接URL复制邀请链接方法
当前页面完整url可以用 location.href
路由路径可以用 this.$route.path
路由路径参数 this.$route.params
实例:动态邀请链接,获得当前页面URL去掉path,替换成注册的加上邀请码:
this.invitelink = location.href.replace(this.$route.path,'') + "/register?invitecode=" + this.invitecode;
复制邀请链接方法:
main.js里添加:
import VueClipboard from 'vue-clipboard2'
Vue.use(VueClipboard) 阅读全文