Commit c7082bdb authored by Jenny's avatar Jenny

feat: tabs选项卡 select修改

parent a78e3e01
<template>
<u-select
v-model="params.show"
:default-value="params.defaultValue"
:list="params.list"
:safe-area-inset-bottom="true"
label-name="name"
:z-index="999999"
@confirm="handleSelectChange"
></u-select>
</template>
<script>
export default {
name: 'MySelect',
data() {
return {
params: {}
}
},
created() {
uni.$on('showSelect', data => {
this.params = data
})
},
destroyed() {
uni.$off('showSelect')
},
methods: {
handleSelectChange(e) {
uni.$emit(`changeSelect-${this.params.id}`, e)
}
}
}
</script>
<style></style>
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
this.sticky = sticky this.sticky = sticky
}) })
}, },
destroy() { destroyed() {
uni.$off(elementInfo.id) uni.$off(elementInfo.id)
}, },
methods: { methods: {
......
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
<template v-if="elementInfo.option.tabs.type === 'select'"> <template v-if="elementInfo.option.tabs.type === 'select'">
<view class="input-group"> <view class="input-group">
<u-input v-model="selectValue" type="select" border="true" <u-input v-model="selectValue" type="select" border="true"
:placeholder="elementInfo.option.tabs.placeholder" @click="show = true" /> :placeholder="elementInfo.option.tabs.placeholder" @click="handleShowSelect" />
<u-icon class="close-icon" v-if="tabsValue && elementInfo.option.tabs.allowClear" name="close-circle" <u-icon class="close-icon" v-if="tabsValue && elementInfo.option.tabs.allowClear" name="close-circle"
@click.prevent.stop="handleClearValue"></u-icon> @click.prevent.stop="handleClearValue"></u-icon>
</view> </view>
<u-select v-model="show" :default-value="defaultValue" :list="elementData.dataList.series" <!-- <u-select v-model="show" :default-value="defaultValue" :list="elementData.dataList.series"
:safe-area-inset-bottom="true" label-name="name" :z-index="zIndex" @confirm="handleSelectChange"> :safe-area-inset-bottom="true" label-name="name" :z-index="zIndex" @confirm="handleSelectChange">
</u-select> </u-select> -->
</template> </template>
<swiper v-if="elementInfo.option.tabs.type === 'group'" class="tab-swiper" <swiper v-if="elementInfo.option.tabs.type === 'group'" class="tab-swiper"
...@@ -49,9 +49,13 @@ ...@@ -49,9 +49,13 @@
uni.$on('handlePullDownRefresh', () => { uni.$on('handlePullDownRefresh', () => {
this.initChart() this.initChart()
}) })
uni.$on(`changeSelect-${this.elementInfo.id}`, e => {
this.handleSelectChange(e)
})
}, },
destroy() { destroyed() {
uni.$off('handlePullDownRefresh') uni.$off('handlePullDownRefresh')
uni.$off(`changeSelect-${this.elementInfo.id}`)
}, },
computed: { computed: {
tabsGroup() { tabsGroup() {
...@@ -104,6 +108,14 @@ ...@@ -104,6 +108,14 @@
} }
} }
}, },
handleShowSelect() {
uni.$emit('showSelect', {
id: this.elementInfo.id,
show: true,
list: this.elementData.dataList.series,
defaultValue: this.defaultValue
})
},
setTabsValue(index = 0) { setTabsValue(index = 0) {
this.currentTabs = index this.currentTabs = index
this.defaultValue = [0] this.defaultValue = [0]
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
height: `${element.type == 'HorizontalBar' && horizontalBarHeight ? horizontalBarHeight : parseInt(element.height * scale)}px`, height: `${element.type == 'HorizontalBar' && horizontalBarHeight ? horizontalBarHeight : parseInt(element.height * scale)}px`,
left: `${parseInt(element.left * scale)}px`, left: `${parseInt(element.left * scale)}px`,
top: `${parseInt(element.top * scale)}px`, top: `${parseInt(element.top * scale)}px`,
zIndex: `${element.type == 'NormalTabs' || element.type == 'DateTimePicker' ? 9999 : index + 1}` zIndex: `${element.type == 'DateTimePicker' ? 9999 : index + 1}`
}" }"
> >
<!-- 普通柱状图 --> <!-- 普通柱状图 -->
...@@ -65,6 +65,9 @@ ...@@ -65,6 +65,9 @@
:customRender="customRender" :customRender="customRender"
@close="popupShow=false" @close="popupShow=false"
></ModelData> ></ModelData>
<MySelect></MySelect>
</view> </view>
</template> </template>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
height: `${element.type == 'HorizontalBar' && horizontalBarHeight ? horizontalBarHeight : parseInt(element.height * scale)}px`, height: `${element.type == 'HorizontalBar' && horizontalBarHeight ? horizontalBarHeight : parseInt(element.height * scale)}px`,
left: `${parseInt(element.left * scale)}px`, left: `${parseInt(element.left * scale)}px`,
top: `${parseInt(element.top * scale)}px`, top: `${parseInt(element.top * scale)}px`,
zIndex: `${element.type == 'NormalTabs' || element.type == 'DateTimePicker' ? 9999 : index + 1}` zIndex: `${element.type == 'DateTimePicker' ? 9999 : index + 1}`
}" }"
> >
<!-- 普通柱状图 --> <!-- 普通柱状图 -->
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
:customRender="customRender" :customRender="customRender"
@close="popupShow=false" @close="popupShow=false"
></ModelData> ></ModelData>
<MySelect></MySelect>
</view> </view>
</template> </template>
......
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