app-date-range.vue 1.2 KB
Newer Older
1 2 3 4 5 6 7
<template>
    <date-picker></date-picker>
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
@Component({})
8
export default class AppDateRange extends Vue {
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

    /**
     * 当前值
     * 
     * @type {*}
     * @memberof AppSpan
     */
    @Prop() public value?: any;

    /**
     * 数据类型
     * 
     * @type {string}
     * @memberof AppSpan
     */
    @Prop({default: 'datetime'}) public type?: 'datetime' | 'date';

    /**
     * 是否禁用
     * 
     * @type {string}
     * @memberof AppSpan
     */
    @Prop({default: false}) public disabled?: boolean;

    /**
     * 日期值格式化
     * 
     * @type {string}
     * @memberof AppSpan
     */
    @Prop() public valueFormat?: string;

    /**
     * 传入表单数据
     *
     * @type {*}
     * @memberof AppSpan
     */
    @Prop() public data?: any;

    /**
     * 监控表单属性 data 值
     *
     * @memberof AppSpan
     */
    @Watch('data')
    onDataChange(newVal: any, oldVal: any) {
        if(newVal !== oldVal){
           console.log(newVal);
        }
    }
    
}
</script>

65 66
<style lang='scss'>
@import './app-date-range.scss';
67
</style>