This commit is contained in:
yanran200730
2022-01-14 09:21:24 +08:00
parent 1d02347647
commit dc7b87c5f8
2 changed files with 15 additions and 5 deletions

View File

@@ -3,9 +3,10 @@
<u-calendar v-model="show" :maxDate="maxDate"
@change="handleSelect" :mode="mode" @close="show=false"/>
<div flex @click="show=true">
<div v-if="label" v-html="label"/>
<div v-else v-html="placeholder"/>
<i class="iconfont iconfont-iconArrow_Down"/>
<div class="label" v-if="label" v-html="label"/>
<div class="placeholder" v-else v-html="placeholder"/>
<u-icon name="arrow-right" color="#ddd"/>
<!-- <i class="iconfont iconfont-iconArrow_Down"/> -->
</div>
</section>
</template>
@@ -18,7 +19,7 @@ export default {
computed: {
label() {
let arr = (this.selected || this.value)?.toString()?.split(",") || []
arr = arr.map(e => dayjs(e).format("MM-DD").replace("Invalid Date", ''))
arr = arr.map(e => dayjs(e).format("YYYY-MM-DD").replace("Invalid Date", ''))
return arr.join('至')
}
},
@@ -36,6 +37,7 @@ export default {
},
methods: {
handleSelect(v) {
console.log(v)
if (this.mode == 'date') {
this.selected = v.result
this.$emit('change', v.result)
@@ -52,6 +54,14 @@ export default {
.AiDate {
color: #333333;
.label {
font-size: 30px;
}
.placeholder {
color: $uni-text-color-grey;
}
.iconfont-iconArrow_Down {
margin-left: 4px;
font-size: 32px;

View File

@@ -80,7 +80,7 @@ export default {
.selectedLabel {
flex: 1;
min-width: 0;
max-width: 450px;
overflow: hidden;
text-overflow: ellipsis;
font-size: 30px;