tiny-vue/examples/sites/demos/mobile-first/app/date-picker-mobile/disabled.vue

51 lines
1.1 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="demo-date-picker-mobile-container">
<tiny-button @click="fn" type="primary"> 日期选择器组件 </tiny-button>
<p>{{ value }}</p>
<p>格式化值{{ formatValue }}</p>
<tiny-date-picker-mobile
v-model="value"
title="日期选择"
:picker-options="pickerOptions"
:visible="boxVisibility"
@update:visible="boxVisibility = $event"
>
</tiny-date-picker-mobile>
</div>
</template>
<script>
import { DatePickerMobileFirst, Button } from '@opentiny/vue'
export default {
components: {
TinyDatePickerMobile: DatePickerMobileFirst,
TinyButton: Button
},
data() {
return {
value: '',
boxVisibility: false,
pickerOptions: {
disabledDate: (date) => {
return date.getTime() > Date.now()
}
}
}
},
computed: {
formatValue() {
if (!this.value) return ''
const date = new Date(this.value)
return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`
}
},
methods: {
fn() {
this.boxVisibility = true
}
}
}
</script>