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

View File

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