WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2023-03-15 55a5ba2d0f43e507e97de31a9c7c9f7e8a6f599c
forms/datePicker/CDatePicker.vue
@@ -23,9 +23,14 @@
                :placeholder="placeholder"
            >
                <view
                    v-show="!readOnly"
                    v-show="!readOnly && !showClear"
                    class="at-icon at-icon-chevron-right"
                />
                <view
                    v-show="showClear"
                    class="at-icon at-icon-close"
                    @tap.stop="evt => handleClear()"
                ></view>
            </AtInput>
        </CDateRangeAction>
        <CDateTimeAction
@@ -43,9 +48,14 @@
                :placeholder="placeholder"
            >
                <view
                    v-show="!readOnly"
                    v-show="!readOnly && !showClear"
                    class="at-icon at-icon-chevron-right"
                />
                <view
                    v-show="showClear"
                    class="at-icon at-icon-close"
                    @tap.stop="evt => handleClear()"
                ></view>
            </AtInput>
        </CDateTimeAction>
        <view v-else-if="mode==='date'">
@@ -53,6 +63,7 @@
                mode="date"
                :start="limitStart || pickerStart"
                :end="limitEnd || pickerEnd"
                :fields="fields"
                :value="itemRes.formData[itemRes.name]"
                @change="evt=>handleChange(evt.detail.value)"
            >
@@ -65,9 +76,14 @@
                    :placeholder="placeholder"
                >
                    <view
                        v-show="!readOnly"
                        v-show="!readOnly && !showClear"
                        class="at-icon at-icon-chevron-right"
                    />
                    <view
                        v-show="showClear"
                        class="at-icon at-icon-close"
                        @tap.stop="evt => handleClear()"
                    ></view>
                </AtInput>
            </picker>
        </view>
@@ -103,8 +119,18 @@
        limitStart: String,
        // 结束日期
        limitEnd: String,
        // 日期选择粒度 year、month、day
        fields: {
            type: String,
            default: 'day',
        },
        // 是否只读
        readOnly: {
            type: Boolean,
            default: false,
        },
        // 允许清除
        allowClear: {
            type: Boolean,
            default: false,
        },
@@ -116,11 +142,21 @@
            pickerEnd: year + 30 + '-12-31',
        };
    },
    computed: {},
    computed: {
        showClear() {
            if (!this.allowClear) {
                return false;
            }
            return !!this.itemRes.formData[this.itemRes.name];
        },
    },
    methods: {
        handleChange(val) {
            this.itemRes.onChange(val);
        },
        handleClear() {
            this.itemRes.onChange('');
        },
    },
    mounted() {},
};