tiny-vue/examples/sites/demos/mobile-first/app/calendar-bar/render-today.vue

32 lines
652 B
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>
<tiny-calendar-bar v-model="value" :config="config"></tiny-calendar-bar>
</template>
<script>
import { CalendarBar } from '@opentiny/vue'
export default {
components: {
TinyCalendarBar: CalendarBar
},
data() {
return {
value: new Date().toLocaleDateString(),
config: {
renderItem: this.renderItem
}
}
},
methods: {
renderItem({ h, item, text }) {
// 对今天日期选项进行定制渲染
if (item && item.isToday) {
return h('span', '今')
}
// 默认返回falsy值其他日期选项仍然使用内部渲染
return null
}
}
}
</script>