mirror of https://github.com/ElemeFE/element
parent
b5e97d857d
commit
fce92e8b4e
|
@ -17,6 +17,7 @@
|
||||||
- TableColumn 的 showTooltipWhenOverflow 更名为 showOverflowTooltip(两个属性均可用)
|
- TableColumn 的 showTooltipWhenOverflow 更名为 showOverflowTooltip(两个属性均可用)
|
||||||
- TableColumn 新增属性 render-header
|
- TableColumn 新增属性 render-header
|
||||||
- Pagination 新增属性 pageCount
|
- Pagination 新增属性 pageCount
|
||||||
|
- DatePicker 修复重置 value 后默认选中日期没有重置, #878
|
||||||
|
|
||||||
#### 非兼容性更新
|
#### 非兼容性更新
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,10 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
handleClear() {
|
||||||
|
this.date = new Date();
|
||||||
|
},
|
||||||
|
|
||||||
resetDate() {
|
resetDate() {
|
||||||
this.date = new Date(this.date);
|
this.date = new Date(this.date);
|
||||||
},
|
},
|
||||||
|
|
|
@ -221,6 +221,9 @@ export default {
|
||||||
val ? this.showPicker() : this.hidePicker();
|
val ? this.showPicker() : this.hidePicker();
|
||||||
},
|
},
|
||||||
value(val) {
|
value(val) {
|
||||||
|
if (!val && this.picker && typeof this.picker.handleClear === 'function') {
|
||||||
|
this.picker.handleClear();
|
||||||
|
}
|
||||||
this.dispatch('form-item', 'el.form.change');
|
this.dispatch('form-item', 'el.form.change');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -66,6 +66,35 @@ describe('DatePicker', () => {
|
||||||
}, DELAY);
|
}, DELAY);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('reset', done => {
|
||||||
|
vm = createVue({
|
||||||
|
template: `
|
||||||
|
<el-date-picker ref="compo" v-model="value"></el-date-picker>
|
||||||
|
`,
|
||||||
|
data() {
|
||||||
|
return { value: '' };
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
const input = vm.$el.querySelector('input');
|
||||||
|
|
||||||
|
input.blur();
|
||||||
|
input.focus();
|
||||||
|
setTimeout(_ => {
|
||||||
|
const $el = vm.$refs.compo.picker.$el;
|
||||||
|
$el.querySelector('.el-date-picker__next-btn.el-icon-arrow-right').click();
|
||||||
|
setTimeout(_ => {
|
||||||
|
$el.querySelector('td.available').click();
|
||||||
|
vm.$nextTick(_ => {
|
||||||
|
vm.value = '';
|
||||||
|
setTimeout(_ => {
|
||||||
|
expect(vm.$refs.compo.picker.date.getDate()).to.equal(new Date().getDate());
|
||||||
|
done();
|
||||||
|
}, DELAY);
|
||||||
|
});
|
||||||
|
}, DELAY);
|
||||||
|
}, DELAY);
|
||||||
|
});
|
||||||
|
|
||||||
describe('keydown', () => {
|
describe('keydown', () => {
|
||||||
let input;
|
let input;
|
||||||
let keyDown = function(el, keyCode) {
|
let keyDown = function(el, keyCode) {
|
||||||
|
|
Loading…
Reference in New Issue