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

114 lines
1.8 KiB
Vue
Raw Normal View History

2023-12-18 16:30:33 +00:00
<template>
2024-01-29 10:05:13 +00:00
<view :class="contClass" :style="styles">
<u-row custom-style="width: 100%;">
2023-12-18 16:30:33 +00:00
<view style="flex: 1;">
2024-05-19 05:56:23 +00:00
<u-text :text="leftText" size="28" :lines="1"></u-text>
2023-12-18 16:30:33 +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 = ''
if (this.value) {
const curItem = this.list.filter(item => item.val == this.value)[0] || {}
curItem.title && (str = curItem.title)
2024-05-19 05:56:23 +00:00
}
if(!str && Array.isArray(this.checkedList)) {
str = this.checkedList.map(t=> t.title).join(',')
}
if(!str) {
2023-12-18 16:30:33 +00:00
str = this.placeholder
}
return str
},
contClass() {
2024-01-29 10:05:13 +00:00
let pre = ['radius-10']
2023-12-18 16:30:33 +00:00
if (this.isWhite) {
2024-01-29 10:05:13 +00:00
pre.push('c-white')
2023-12-18 16:30:33 +00:00
} else {
2024-01-29 10:05:13 +00:00
pre.push('c-grey')
2023-12-18 16:30:33 +00:00
}
return pre.join(" ")
2024-01-29 10:05:13 +00:00
},
styles() {
return `margin-top: 0;height: 62rpx;${this.customStyle}`
2023-12-18 16:30:33 +00:00
}
},
props: {
2024-01-29 10:05:13 +00:00
customStyle: {
default () {
return ''
}
},
2023-12-18 16:30:33 +00:00
isWhite: {
default () {
return false
}
},
placeholder: {
default () {
return ''
}
},
show: {
default () {
return false
}
},
value: {
default () {
return ''
}
},
list: {
default () {
return []
}
2024-05-19 05:56:23 +00:00
},
checkedList: {
default () {
return []
}
},
2023-12-18 16:30:33 +00:00
},
data() {
return {
}
},
created() {
},
onHide() {
},
2024-01-30 03:09:14 +00:00
unmounted() {},
2023-12-18 16:30:33 +00:00
methods: {}
}
</script>
<style scoped lang="scss">
2024-01-29 10:05:13 +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-18 16:30:33 +00:00
</style>