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

tag组件存在严重的bug #118

Open
modifMX opened this issue Oct 17, 2019 · 0 comments
Open

tag组件存在严重的bug #118

modifMX opened this issue Oct 17, 2019 · 0 comments

Comments

@modifMX
Copy link

modifMX commented Oct 17, 2019

比如
<tag type="info" v-for="(keyword, i) in kws" :key="i" :on-close="closeTag(i)" :closable="closable">{{keyword}}</tag>

  1. 这个我必须吧,i 传入函数中,应为我需要同i删除数组, 但是这样编写,在加载页面时调用一次closeTag函数,虽然可以通过return 函数的方式解决,但是并不优雅; 复杂的业务逻辑存在问题

2 我在closeTag 中更新了 kws 比如删除数组索引为0的标签,vue有着异步更新机制,这会导致删除新的索引为0的的标签
应为
setTimeout(() => { this.$destroy(); this.$el.remove(); }, 100);
这里会在超时后 删除 this.$destroy(); this.$el.remove();

解决方法是 这样
:key="keyword+'-'+i"

上面问题,最佳解决
// this.$emit('close', e);// the way official suggested
但是需要重新编译 vue-blu

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

1 participant