提交 32b4ebe8 编写于 作者: D dolymood

feat(tab-panels): support value prop for tab-panel

上级 5e1a83b2
......@@ -13,6 +13,12 @@
label: {
type: [String, Number],
required: true
},
value: {
type: [String, Number],
default() {
return this.label
}
}
},
mounted () {
......
......@@ -5,7 +5,8 @@
<cube-tab-panel
v-for="(item, index) in data"
:label="item.label"
:key="item.label">
:value="item.value"
:key="item.value || item.label">
{{item.label}}
</cube-tab-panel>
</slot>
......@@ -42,8 +43,8 @@
this._move(this.value)
},
methods: {
_move(label) {
const curIndex = findIndex(this.panels, panel => panel.label === label)
_move(value) {
const curIndex = findIndex(this.panels, panel => panel.value === value)
/* istanbul ignore if */
if (curIndex === INDEX_OUT_OF_BOUNDARY) {
return
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册