emis-sapp/components/tpx-select/default-select-input.vue

105 lines
1.6 KiB
Vue
Raw Normal View History

2023-12-10 19:04:55 +00:00
<template>
2024-01-29 10:48:55 +00:00
<view :class="contClass" :style="styles">
<u-row custom-style="width: 100%;">
2023-12-10 19:04:55 +00:00
<view style="flex: 1;">
2023-12-12 05:36:04 +00:00
<u-text :text="leftText" size="28"></u-text>
2023-12-10 19:04:55 +00:00
</view>
<u-row>
<u-icon size="22" :name="`${show?'arrow-up':'arrow-down'}`" color="#333"></u-icon>
</u-row>
</u-row>
</view>
</template>
<script>
export default {
computed: {
leftText() {
let str = ''
2023-12-12 05:36:04 +00:00
if (this.value) {
const curItem = this.list.filter(item => item.val == this.value)[0] || {}
2023-12-10 19:04:55 +00:00
curItem.title && (str = curItem.title)
} else {
str = this.placeholder
}
return str
},
2023-12-12 05:36:04 +00:00
contClass() {
2024-01-29 10:48:55 +00:00
let pre = ['radius-10']
2023-12-12 05:36:04 +00:00
if (this.isWhite) {
2024-01-29 10:48:55 +00:00
pre.push('c-white')
2023-12-12 05:36:04 +00:00
} else {
2024-01-29 10:48:55 +00:00
pre.push('c-grey')
2023-12-12 05:36:04 +00:00
}
return pre.join(" ")
2024-01-29 10:48:55 +00:00
},
styles() {
return `margin-top: 0;height: 62rpx;${this.customStyle}`
2023-12-12 05:36:04 +00:00
}
2023-12-10 19:04:55 +00:00
},
props: {
2024-01-29 10:48:55 +00:00
customStyle: {
default () {
return ''
}
},
2023-12-12 05:36:04 +00:00
isWhite: {
default () {
return false
2023-12-10 19:04:55 +00:00
}
},
placeholder: {
2023-12-12 05:36:04 +00:00
default () {
2023-12-10 19:04:55 +00:00
return ''
}
},
show: {
2023-12-12 05:36:04 +00:00
default () {
2023-12-10 19:04:55 +00:00
return false
}
},
value: {
2023-12-12 05:36:04 +00:00
default () {
2023-12-10 19:04:55 +00:00
return ''
}
},
list: {
2023-12-12 05:36:04 +00:00
default () {
2023-12-10 19:04:55 +00:00
return []
}
}
},
data() {
return {
2023-12-12 05:36:04 +00:00
2023-12-10 19:04:55 +00:00
}
},
created() {
},
onHide() {
},
destroyed() {},
2023-12-12 05:36:04 +00:00
methods: {}
2023-12-10 19:04:55 +00:00
}
</script>
<style scoped lang="scss">
2024-01-29 10:48:55 +00:00
.c-white,.c-grey{
display: flex;
padding-left: 20rpx;
padding-right: 20rpx;
border-radius: 10rpx;
align-items: center;
}
.c-white{
background-color: #fff;
border: 1rpx solid #dadbde;
}
.c-grey{
background-color: #F6F6F6;
border: 1rpx solid #dadbde;
}
2023-12-10 19:04:55 +00:00
</style>