Commit cd255f33 authored by Jenny's avatar Jenny

feat: tabs select default-value

parent 8028086b
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
/> />
<u-select <u-select
v-model="show" v-model="show"
:default-value="defaultValue"
:list="elementData.dataList.series" :list="elementData.dataList.series"
:safe-area-inset-bottom="true" :safe-area-inset-bottom="true"
label-name="name" label-name="name"
...@@ -56,7 +57,8 @@ ...@@ -56,7 +57,8 @@
return { return {
currentTabs: 0, currentTabs: 0,
show: false, show: false,
tabsValue: '' tabsValue: '',
defaultValue: [0]
}; };
}, },
mounted() { mounted() {
...@@ -87,12 +89,12 @@ ...@@ -87,12 +89,12 @@
'--border-style': `${frameWidth}px ${frameStyle} ${frameColor}`, '--border-style': `${frameWidth}px ${frameStyle} ${frameColor}`,
'--item-background-color': itemBackgroundColor '--item-background-color': itemBackgroundColor
} }
} }
}, },
methods: { methods: {
initChart(index = 0) { initChart(index = 0) {
this.currentTabs = index this.currentTabs = index
this.defaultValue = [0]
this.tabsValue = this.elementData.dataList.series[this.currentTabs].value this.tabsValue = this.elementData.dataList.series[this.currentTabs].value
}, },
handleTabsChange(index) { handleTabsChange(index) {
...@@ -101,6 +103,7 @@ ...@@ -101,6 +103,7 @@
}, },
handleSelectChange(e) { handleSelectChange(e) {
this.tabsValue = e[0].value this.tabsValue = e[0].value
this.defaultValue[0] = [this.elementData.dataList.series.findIndex(item => item.value === e[0].value)]
this.tabsValueChange() this.tabsValueChange()
}, },
handleChangeTabValue(value) { handleChangeTabValue(value) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment