Commit fae1ae09 authored by 刘用法's avatar 刘用法

完工页面select组件

parent 6caf4884
...@@ -42,7 +42,8 @@ ...@@ -42,7 +42,8 @@
'border-radius': '12rpx', 'border-radius': '12rpx',
'color': '#333333', 'color': '#333333',
'padding-left': '20rpx', 'padding-left': '20rpx',
'width': this.width 'width': this.width,
'font-size':'26rpx'
} }
} }
}, },
......
<!-- ******************* 单个下拉选择 ******************* --> <!-- ******************* 单个下拉选择 ******************* -->
<template> <template>
<view> <view class="xh-select">
<u-input :value="text" readOnly @click="show=true" type="select" /> <u-input :value="text" readOnly @click="show=true" :placeholder="placeholder" :placeholder-style="placeholderStyle"
<u-action-sheet :list="settings" v-model="show" @click="actionSheetCallback"></u-action-sheet> :custom-style="customStyle" :clearable="false"></u-input>
<u-action-sheet :list="settings" v-model="show" @click="actionSheetCallback" safe-area-inset-bottom></u-action-sheet>
<u-icon class="input-icon" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view> </view>
</template> </template>
...@@ -12,7 +15,16 @@ ...@@ -12,7 +15,16 @@
name: 'XhSelect', name: 'XhSelect',
components: {}, components: {},
mixins: [stringMixin], mixins: [stringMixin],
props: {}, props: {
placeholder: {
type: String,
default: '请选择'
},
width: { // 例如:454rpx
type: String,
default: '100%'
}
},
data() { data() {
return { return {
show: false show: false
...@@ -32,7 +44,9 @@ ...@@ -32,7 +44,9 @@
result = settings.map(item => { result = settings.map(item => {
return { return {
text: item.label, text: item.label,
id: item.key id: item.key,
color: '#333333',
fontSize: 26
} }
}) })
return result return result
...@@ -40,6 +54,20 @@ ...@@ -40,6 +54,20 @@
text(){ text(){
let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue}) let option = this.item.fieldsOptions.find(a=>{return a.key === this.dataValue})
return option?option.label:'' return option?option.label:''
},
placeholderStyle() {
return 'color:#999999;font-size:26rpx'
},
customStyle() {
return {
'background-color': '#F4F5F7',
'border-radius': '12rpx',
'color': '#333333',
'padding-left': '20rpx',
'padding-right': '60rpx',
'width': this.width,
'font-size':'26rpx'
}
} }
}, },
watch: {}, watch: {},
...@@ -54,5 +82,15 @@ ...@@ -54,5 +82,15 @@
} }
</script> </script>
<style> <style lang="scss" scoped>
.xh-select {
position: relative;
.input-icon {
position: absolute;
right: 20rpx;
top: 20rpx;
color: #2272FF;
}
}
</style> </style>
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