This commit is contained in:
梁灏 2017-11-08 20:44:35 +08:00
parent b142865eff
commit 22c27b7962
2 changed files with 63 additions and 40 deletions

View file

@ -1,43 +1,43 @@
<template> <!--<template>-->
<div> <!--<div>-->
{{ value1 }} <!--{{ value1 }}-->
<Date-picker v-model="value1" type="datetimerange" placeholder="选择日期" style="width: 200px" @on-change="hc"></Date-picker> <!--<Date-picker v-model="value1" type="datetimerange" placeholder="选择日期" style="width: 200px" @on-change="hc"></Date-picker>-->
<Button @click="setDate">set date</Button> <!--<Button @click="setDate">set date</Button>-->
<Button @click="getDate">get date</Button> <!--<Button @click="getDate">get date</Button>-->
<!--<Date-picker v-model="value2" type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker>--> <!--&lt;!&ndash;<Date-picker v-model="value2" type="daterange" placeholder="选择日期" style="width: 200px"></Date-picker>&ndash;&gt;-->
<!--<Date-picker transfer type="datetimerange" placeholder="选择日期" style="width: 200px" @on-change="changeDate"></Date-picker>--> <!--&lt;!&ndash;<Date-picker transfer type="datetimerange" placeholder="选择日期" style="width: 200px" @on-change="changeDate"></Date-picker>&ndash;&gt;-->
</div> <!--</div>-->
</template> <!--</template>-->
<script> <!--<script>-->
export default { <!--export default {-->
data () { <!--data () {-->
return { <!--return {-->
value1: ['2014-10-10 10:00:01', '2017-10-10 10:00:00'], <!--value1: ['2014-10-10 10:00:01', '2017-10-10 10:00:00'],-->
value2: [] <!--value2: []-->
} <!--}-->
}, <!--},-->
methods: { <!--methods: {-->
changeDate(date){ <!--changeDate(date){-->
console.log(date); <!--console.log(date);-->
}, <!--},-->
setDate () { <!--setDate () {-->
this.value1 = ['2016-10-10', '2017-10-10']; <!--this.value1 = ['2016-10-10', '2017-10-10'];-->
}, <!--},-->
getDate () { <!--getDate () {-->
const date = new Date(this.value1); <!--const date = new Date(this.value1);-->
console.log(date.getMonth()+1) <!--console.log(date.getMonth()+1)-->
}, <!--},-->
hc (d) { <!--hc (d) {-->
console.log(d); <!--console.log(d);-->
} <!--}-->
} <!--}-->
} <!--}-->
</script> <!--</script>-->
<style> <!--<style>-->
body{ <!--body{-->
width: 100%; <!--width: 100%;-->
} <!--}-->
</style> <!--</style>-->
<!--<template>--> <!--<template>-->
@ -189,3 +189,22 @@
<template>
<div>
<DatePicker v-model="value" @on-change="handleChange" type="date" placeholder="Select date" style="width: 200px"></DatePicker>
</div>
</template>
<script>
export default {
data () {
return {
value: new Date()
}
},
methods: {
handleChange (v) {
console.log(v);
}
}
}
</script>

View file

@ -404,6 +404,10 @@
this.currentValue = ''; this.currentValue = '';
this.$emit('on-clear'); this.$emit('on-clear');
this.dispatch('FormItem', 'on-form-change', ''); this.dispatch('FormItem', 'on-form-change', '');
// #2215 value clear this.picker
if (!this.picker) {
this.emitChange('');
}
}, },
showPicker () { showPicker () {
if (!this.picker) { if (!this.picker) {