This commit is contained in:
aihe 2024-05-23 01:48:52 +08:00
parent 10ad30e4ff
commit 70d1b353fe
4 changed files with 32 additions and 34 deletions

View File

@ -2,7 +2,7 @@
<view :class="contClass" :style="styles">
<u-row custom-style="width: 100%;">
<view style="flex: 1;">
<u-text :text="leftText" size="28" :lines="1"></u-text>
<tpx-text-dic :value="value" :list="list" :checkedList="checkedList" :text="text" :placeholder="placeholder"></tpx-text-dic>
</view>
<u-row>
<u-icon size="22" :name="`${show?'arrow-up':'arrow-down'}`" color="#333"></u-icon>
@ -14,13 +14,6 @@
<script>
export default {
computed: {
leftText() {
let str = this.text || ''
if(!str) {
str = this.placeholder
}
return str
},
contClass() {
let pre = ['radius-10']
if (this.isWhite) {
@ -55,6 +48,21 @@
return false
}
},
list: {
default () {
return []
}
},
checkedList: {
default () {
return []
}
},
value: {
default () {
return ""
}
},
text: {
default () {
return ''

View File

@ -4,6 +4,7 @@
<slot v-if="$slots.default"></slot>
<template v-else>
<default-select-input v-if="selectTextType == 'input'" :placeholder="placeholder" :show="show"
:value="value" :list="filDataList" :checkedList="filDatacheckedList"
:isWhite="isWhite" :text="text" :customStyle="customStyle"
></default-select-input>
<DefaultSelectText v-if="selectTextType == 'text'"></DefaultSelectText>

View File

@ -6,30 +6,34 @@
export default {
computed: {
title() {
let title = this.value
let val = this.value
if(val && this.list) {
if(!Array.isArray(val) && val.split) {
val = val.split(",")
}
title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
val = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
}
if(Array.isArray(this.checkedList)) {
val = this.checkedList.map(t=> t.title).join(',')
}
if((!title || title?.length == 0) && (this.list || this.checkedList?.length == 0)) {
title = '-'
}
return title
val = val || this.text || this.placeholder
return val
}
},
props: {
value: {
},
text: {
},
list: {
},
checkedList: {
},
placeholder: {
default () {
return '-'
}
},
},
data() {
return {

View File

@ -8,10 +8,11 @@
</view>
<u-row :custom-style="`min-width: ${rightWidth}rpx;`" justify="end" align="center">
<template v-if="!$slots.right">
<u-text align="right" margin="0 12rpx 0 0" size="26"
:text="title"></u-text>
<view style="margin-right: 12rpx; flex:1; text-align: right;">
<tpx-text-dic :value="value" :list="list" :checkedList="checkedList" :placeholder="placeholder"></tpx-text-dic>
</view>
<template v-if="!$slots.rightRcon">
<u-icon v-if="list || checkedList" size="26" name="arrow-right" color="#333"></u-icon>
<u-icon size="26" name="arrow-right" color="#333"></u-icon>
</template>
<slot name="rightRcon"></slot>
</template>
@ -23,23 +24,7 @@
<script>
export default {
computed: {
title() {
let title = this.value
let val = this.value
if(val && this.list) {
if(!Array.isArray(val) && val.split) {
val = val.split(",")
}
title = this.list.filter(t=> t.val == val || (val.indexOf && val.indexOf(t.val) > -1)).map(t=> t.title).join(",")
}
if(Array.isArray(this.checkedList)) {
title = this.checkedList.map(t=> t.title).join(',')
}
if((!title || title?.length == 0) && (this.list || this.checkedList?.length == 0)) {
title = this.placeholder
}
return title
}
},
props: {
rightWidth:{