Tabs里面动态修改tab的label之后,tab标签不能及时更新, 总是跟实际数据晚了一步
https://jsfiddle.net/liangshuai/ee01h7bq/2/
var Main = {
template: `
<el-tabs type="border-card">
<el-tab-pane :name="index" v-for="(item, index) in tabs">
<span slot="label">{{ item.name }}</span>
<div>
{{ item.name }}
<input type="text" v-model="item.name" name="name"/>
</div>
</el-tab-pane>
</el-tabs>
`,
data() {
return {
tabs: [
{
name: 'tab1',
content: 'Content Tab1'
},
{
name: 'tab2',
content: 'Content Tab2'
},
{
name: 'tab3',
content: 'Content Tab3'
}
]
}
},
}
new Vue({
el: '#app',
render: h => h(Main)
})
最新版已修复这个问题
cdn加载的话, 依然存在此问题, slot="label"内的数据, 并不能实时刷新
问题依然存在,element-ui 2.5.4, vue 2.6.4.
a work around. add a ref attribute to \ after data updated, run this.$refs.tabs.$refs.nav.$forceUpdate();
Problem still remains on the latest version 2.5.4
问题依旧存在
element: 2.6.1
vue: 2.5.2
问题依旧存在
element: 2.6.1
vue: 2.5.22
问题依旧存在
element: 2.6.1
Vue.js v2.6.8
问题依旧存在
element: 2.6.1
Vue.js 2.9.6
问题依旧存在
element: 2.6.1
Vue.js 2.9.6
i found a simple solution, use "v-if" to update element
like this:
<el-tab-pane
v-if="state.update"
>
<span slot="label">
<el-checkbox/>{{item.Name}}
</span>
</el-tab-pane>
forceRefresh() {
this.state.update = false;
this.$nextTick(() => {
this.state.update = true;
});
}
把:
input
改为:
el-input
就可以了
a work around. add a ref attribute to
, like after data updated, run
this.$refs.tabs.$refs.nav.$forceUpdate();
2.12.0 也没解决,然后用这个forceUpdate也不生效
Most helpful comment
a work around. add a ref attribute to \
after data updated, run