Merge branch 'master' into fix/time-picker-scrollbar

pull/744/head
qingwei.li 2016-10-31 20:52:43 +08:00
commit 72bb5899e5
29 changed files with 472 additions and 357 deletions

View File

@ -1,12 +1,15 @@
## 更新日志
### 1.0.0-rc.9
*2016-11-xx*
*2016-11-XX*
- 新增 MessageBox 确定按钮自动获取焦点, #721
- 修复 Popover focus 失效, #734
- 修复 Clickoutside 报错, #729
- 修复 DatePicker 选择日期范围时当选中同一天再调整时间会出错
- 更新 TimePicker 滚动条在 IE10+ 下隐藏
- 新增 Dropdown 新增 command api #432
### 1.0.0-rc.8

View File

@ -1,6 +1,7 @@
# Element
[![Build Status](https://travis-ci.org/ElemeFE/element.svg?branch=master)](https://travis-ci.org/ElemeFE/element)
[![Coverage Status](https://coveralls.io/repos/github/ElemeFE/element/badge.svg?branch=master)](https://coveralls.io/github/ElemeFE/element?branch=master)
[![CDNJS](https://img.shields.io/cdnjs/v/element-ui.svg)](https://cdnjs.com/libraries/element-ui)
[![npm package](https://img.shields.io/npm/v/element-ui.svg)](https://www.npmjs.org/package/element-ui)
[![NPM downloads](http://img.shields.io/npm/dm/element-ui.svg)](https://npmjs.org/package/element-ui)
![JS gzip size](http://img.badgesize.io/https://unpkg.com/element-ui@next/lib/index.js?compression=gzip&label=gzip%20size:%20JS)

View File

@ -108,38 +108,11 @@
```
:::
### 可切换值的多选框
多选框单独时,除了可以表示为是否选中的逻辑值以外,你还可以设定其选中和未选中所表示的值。
:::demo 使用`true-label`和`false-label`可以自定义选中时和未选中时的值,可以为`String`或`Number`类型。
```html
<template>
<el-checkbox
v-model="isValid"
true-label="可用"
false-label="不可用">
{{isValid}}
</el-checkbox>
</template>
<script>
export default {
data() {
return {
isValid: '可用'
};
}
};
</script>
```
:::
### Checkbox Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|---------- |-------- |---------- |------------- |-------- |
| label | 选中状态的值(只有在`checkbox-group`下有意义) | string | — | — |
| true-label | 选中时的值 | string, number | | — |
| label | 选中状态的值(只有在`checkbox-group`或者绑定对象类型为`array`时有效)| string | — | — |
| true-label | 选中时的值 | string, number | — | — |
| false-label | 没有选中时的值 | string, number | — | — |
| disabled | 按钮禁用 | boolean | — | false |
| checked | 当前是否勾选 | boolean | — | false |

View File

@ -148,7 +148,7 @@
:::
### Attributes
### Dropdown Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------------- |---------------- |---------------- |---------------------- |-------- |
| type | 菜单按钮类型,同 Button 组件(只在`split-button`为 true 的情况下有效) | string | — | — |
@ -157,7 +157,13 @@
| menu-align | 菜单水平对齐方向 | string | start, end | end |
| trigger | 触发下拉的行为 | string | hover, click | hover |
### Events
### Dropdown Events
| 事件名称 | 说明 | 回调参数 |
|---------- |-------- |---------- |
| click | `split-button` 为 true 时,点击左侧按钮的回调 | — |
| command | 点击菜单项触发的事件回调 | dropdown-item 的指令 |
### Dropdown Attributes
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|------------- |---------------- |---------------- |---------------------- |-------- |
| command | 指令 | string | — | — |

View File

@ -13,7 +13,7 @@
} else {
callback();
}
}
}
}, 1000);
};
var validaePass = (rule, value, callback) => {
@ -266,7 +266,7 @@
.el-textarea {
width: auto;
}
.el-select .el-input {
width: 360px;
}
@ -295,7 +295,7 @@
::: demo 在 Form 组件中,每一个表单域由一个 Form-Item 组件构成,表单域中可以放置各种类型的表单控件,包括 Input、Select、Checkbox、Radio、Switch、DatePicker、TimePicker
```html
<el-form ref="form" :model="form" label-width="80px" @submit.prevent="onSubmit">
<el-form ref="form" :model="form" label-width="80px" @submit.native.prevent="onSubmit">
<el-form-item label="活动名称">
<el-input v-model="form.name"></el-input>
</el-form-item>
@ -335,7 +335,7 @@
<el-input type="textarea" v-model="form.desc"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary">立即创建</el-button>
<el-button type="primary" native-type="submit">立即创建</el-button>
<el-button @click.native.prevent>取消</el-button>
</el-form-item>
</el-form>
@ -371,7 +371,7 @@
::: demo Form 组件的 `type` 属性可以控制表单的类型,当设为 `inline` 时可以让表单域变为行内的表单域
```html
<el-form :inline="true" :model="formInline" @submit.prevent="onSubmit" class="demo-form-inline">
<el-form :inline="true" :model="formInline" @submit.native.prevent="onSubmit" class="demo-form-inline">
<el-form-item>
<el-input v-model="formInline.user" placeholder="审批人"></el-input>
</el-form-item><el-form-item>
@ -380,7 +380,7 @@
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item><el-form-item>
<el-button type="primary">查询</el-button>
<el-button native-type="submit" type="primary">查询</el-button>
</el-form-item>
</el-form>
<script>
@ -473,7 +473,7 @@
::: demo 通过设置 `label-position` 属性可以改变表单域标签的位置,可选值为 `top`、`left`,当设为 `left` 时标签会变为左对齐
```html
<el-form :model="formAlignLeft" label-position="left" @submit.prevent="onSubmit" label-width="80px">
<el-form :model="formAlignLeft" label-position="left" @submit.native.prevent="onSubmit" label-width="80px">
<el-form-item label="活动名称">
<el-input v-model="formAlignLeft.name"></el-input>
</el-form-item>
@ -647,7 +647,7 @@
} else {
callback();
}
}
}
}, 1000);
};
var validaePass = (rule, value, callback) => {

View File

@ -306,7 +306,7 @@
适用性较广的基础多选,用 Tag 展示已选项
:::demo 为`el-select`设置`nultiple`属性即可启用多选,此时`v-model`的值为当前选中值所组成的数组
:::demo 为`el-select`设置`multiple`属性即可启用多选,此时`v-model`的值为当前选中值所组成的数组
```html
<template>
<el-select v-model="value5" multiple>

View File

@ -924,6 +924,7 @@
| label | 显示的标题 | string | — | — |
| prop | 对应列内容的字段名,也可以使用 property 属性 | string | — | — |
| width | 对应列的宽度 | string | — | — |
| min-width | 对应列的最小宽度,与 width 的区别是 width 是固定的min-width 会把剩余宽度按比例分配给设置了 min-width 的列 | string | — | — |
| fixed | 列是否固定在左侧或者右侧true 表示固定在左侧 | string, boolean | true, left, right | - |
| sortable | 对应列是否可以排序,如果设置为 'custom',则代表用户希望远程排序,需要监听 Table 的 sort-change 事件 | boolean, string | true, false, 'custom' | false |
| sort-method | 对数据进行排序的时候使用的方法,仅当 sortable 设置为 true 的时候有效 | Function(a, b) | - | - |

View File

@ -144,7 +144,7 @@
| with-credentials | 支持发送 cookie 凭证信息 | boolean | — | false |
| show-upload-list | 是否显示已上传文件列表 | boolean | — | true |
| type | 上传控件类型 | string | select,drag | select |
| accept | 可选参数, 接受上传的[文件类型](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept), 拖拽文件上传时不受此参数影响 | string | — | — |
| accept | 可选参数, 接受上传的[文件类型](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-accept)thumbnail-mode 模式下此参数无效)| string | — | — |
| on-preview | 可选参数, 点击已上传的文件链接时的钩子 | function(file) | — | — |
| on-remove | 可选参数, 文件列表移除文件时的钩子 | function(file, fileList) | — | — |
| on-success | 可选参数, 文件上传成功时的钩子 | function(file, fileList) | — | — |

View File

@ -24,7 +24,7 @@
<input
:placeholder="$t('el.datepicker.startDate')"
class="el-date-range-picker__editor"
:value="leftVisibleDate"
:value="minVisibleDate"
@input="handleDateInput($event, 'min')"
@change="handleDateChange($event, 'min')"/>
</span>
@ -32,15 +32,15 @@
<input
:placeholder="$t('el.datepicker.startTime')"
class="el-date-range-picker__editor"
:value="leftVisibleTime"
@focus="leftTimePickerVisible = !leftTimePickerVisible"
:value="minVisibleTime"
@focus="minTimePickerVisible = !minTimePickerVisible"
@change="handleTimeChange($event, 'min')"/>
<time-picker
:picker-width="leftPickerWidth"
ref="lefttimepicker"
:picker-width="minPickerWidth"
ref="minTimePicker"
:date="minDate"
@pick="handleLeftTimePick"
:visible="leftTimePickerVisible">
@pick="handleMinTimePick"
:visible="minTimePickerVisible">
</time-picker>
</span>
</span>
@ -48,29 +48,29 @@
<span class="el-date-range-picker__editors-wrap is-right">
<span class="el-date-range-picker__time-picker-wrap">
<input
ref="leftInput"
ref="minInput"
:placeholder="$t('el.datepicker.endDate')"
class="el-date-range-picker__editor"
:value="rightVisibleDate"
:value="maxVisibleDate"
:readonly="!minDate"
@input="handleDateInput($event, 'max')"
@change="handleDateChange($event, 'max')" />
</span>
<span class="el-date-range-picker__time-picker-wrap">
<input
ref="rightInput"
ref="maxInput"
:placeholder="$t('el.datepicker.endTime')"
class="el-date-range-picker__editor"
:value="rightVisibleTime"
@focus="minDate && (rightTimePickerVisible = !rightTimePickerVisible)"
:value="maxVisibleTime"
@focus="minDate && (maxTimePickerVisible = !maxTimePickerVisible)"
:readonly="!minDate"
@change="handleTimeChange($event, 'max')" />
<time-picker
:picker-width="rightPickerWidth"
ref="righttimepicker"
:picker-width="maxPickerWidth"
ref="maxTimePicker"
:date="maxDate"
@pick="handleRightTimePick"
:visible="rightTimePickerVisible"></time-picker>
@pick="handleMaxTimePick"
:visible="maxTimePickerVisible"></time-picker>
</span>
</span>
</div>
@ -126,9 +126,9 @@
</div>
</div>
<div class="el-picker-panel__footer" v-if="showTime">
<!-- <a
<a
class="el-picker-panel__link-btn"
@click="changeToToday">{{ $t('el.datepicker.now') }}</a> -->
@click="handleClear">{{ $t('el.datepicker.clear') }}</a>
<button
type="button"
class="el-picker-panel__btn"
@ -175,19 +175,19 @@
return this.rightDate.getMonth();
},
leftVisibleDate() {
minVisibleDate() {
return formatDate(this.minDate);
},
rightVisibleDate() {
maxVisibleDate() {
return formatDate(this.maxDate || this.minDate);
},
leftVisibleTime() {
minVisibleTime() {
return formatDate(this.minDate, 'HH:mm:ss');
},
rightVisibleTime() {
maxVisibleTime() {
return formatDate(this.maxDate, 'HH:mm:ss');
},
@ -208,8 +208,8 @@
data() {
return {
leftPickerWidth: 0,
rightPickerWidth: 0,
minPickerWidth: 0,
maxPickerWidth: 0,
date: new Date(),
minDate: '',
maxDate: '',
@ -224,8 +224,8 @@
value: '',
visible: '',
disabledDate: '',
leftTimePickerVisible: false,
rightTimePickerVisible: false,
minTimePickerVisible: false,
maxTimePickerVisible: false,
width: 0
};
},
@ -234,13 +234,13 @@
showTime(val) {
if (!val) return;
this.$nextTick(_ => {
const leftInputElm = this.$refs.leftInput;
const rightInputElm = this.$refs.rightInput;
if (leftInputElm) {
this.leftPickerWidth = leftInputElm.getBoundingClientRect().width + 10;
const minInputElm = this.$refs.minInput;
const maxInputElm = this.$refs.maxInput;
if (minInputElm) {
this.minPickerWidth = minInputElm.getBoundingClientRect().width + 10;
}
if (rightInputElm) {
this.rightPickerWidth = rightInputElm.getBoundingClientRect().width + 10;
if (maxInputElm) {
this.maxPickerWidth = maxInputElm.getBoundingClientRect().width + 10;
}
});
},
@ -248,17 +248,24 @@
minDate() {
this.$nextTick(() => {
if (this.maxDate && this.maxDate < this.minDate) {
this.maxDate = null;
const format = 'HH:mm:ss';
this.$refs.maxTimePicker.selectableRange = [
[
parseDate(formatDate(this.minDate, format), format),
parseDate('23:59:59', format)
]
];
}
});
},
leftTimePickerVisible(val) {
if (val) this.$nextTick(() => this.$refs.lefttimepicker.ajustScrollTop());
minTimePickerVisible(val) {
if (val) this.$nextTick(() => this.$refs.minTimePicker.ajustScrollTop());
},
rightTimePickerVisible(val) {
if (val) this.$nextTick(() => this.$refs.righttimepicker.ajustScrollTop());
maxTimePickerVisible(val) {
if (val) this.$nextTick(() => this.$refs.maxTimePicker.ajustScrollTop());
},
value(newVal) {
@ -273,6 +280,12 @@
},
methods: {
handleClear() {
this.minDate = '';
this.maxDate = '';
this.handleConfirm();
},
handleDateInput(event, type) {
const value = event.target.value;
const parsedValue = parseDate(value, 'yyyy-MM-dd');
@ -341,10 +354,8 @@
this.maxDate = new Date(target.getTime());
}
}
const l2r = type === 'min' ? 'left' : 'right';
this.$refs[l2r + 'timepicker'].value = target;
this[l2r + 'TimePickerVisible'] = false;
this.$refs[type + 'TimePicker'].value = target;
this[type + 'TimePickerVisible'] = false;
}
},
@ -372,8 +383,8 @@
},
resetView() {
this.leftTimePickerVisible = false;
this.rightTimePickerVisible = false;
this.minTimePickerVisible = false;
this.maxTimePickerVisible = false;
},
setTime(date, value) {
@ -387,18 +398,18 @@
return new Date(oldDate.getTime());
},
handleLeftTimePick(value, visible, first) {
handleMinTimePick(value, visible, first) {
this.minDate = this.minDate || new Date();
if (value) {
this.minDate = this.setTime(this.minDate, value);
}
if (!first) {
this.leftTimePickerVisible = visible;
this.minTimePickerVisible = visible;
}
},
handleRightTimePick(value, visible, first) {
handleMaxTimePick(value, visible, first) {
if (!this.maxDate) {
const now = new Date();
if (now >= this.minDate) {
@ -411,7 +422,7 @@
}
if (!first) {
this.rightTimePickerVisible = visible;
this.maxTimePickerVisible = visible;
}
},

View File

@ -9,9 +9,13 @@
mixins: [Emitter],
props: {
command: String
},
methods: {
handleClick(e) {
this.dispatch('ElDropdown', 'visible', [false]);
this.dispatch('ElDropdown', 'menu-item-click', [this.command, this]);
}
}
};

View File

@ -33,7 +33,7 @@
},
mounted() {
this.$on('visible', value => { this.visible = value; });
this.$on('menu-item-click', this.handleMenuItemClick);
this.initEvent();
},
@ -76,6 +76,10 @@
} else if (trigger === 'click') {
triggerElm.addEventListener('click', handleClick);
}
},
handleMenuItemClick(command, instance) {
this.visible = false;
this.$emit('command', command, instance);
}
},

View File

@ -309,8 +309,10 @@ export default {
/* istanbul ignore if */
if (newVal > 0 && this.internalCurrentPage === 0) {
this.internalCurrentPage = 1;
this.$emit('current-change', 1);
} else if (this.internalCurrentPage > newVal) {
this.internalCurrentPage = newVal;
this.$emit('current-change', newVal);
}
},

View File

@ -5,12 +5,12 @@
@b alert {
width: 100%;
padding: 8px 16px;
padding: var(--alert-padding);
margin: 0;
box-sizing: border-box;
border-radius: 4px;
border-radius: var(--alert-border-radius);
position: relative;
background-color: #fff;
background-color: var(--color-white);
overflow: hidden;
color: #fff;
opacity: 1;
@ -18,19 +18,19 @@
transition: opacity .2s;
@modifier success {
background-color: var(--color-success);
background-color: var(--alert-success-color);
}
@modifier info {
background-color: var(--color-info);
background-color: var(--alert-info-color);
}
@modifier warning {
background-color: var(--color-warning);
background-color: var(--alert-warning-color);
}
@modifier error {
background-color: var(--color-danger);
background-color: var(--alert-danger-color);
}
@e content {
@ -39,19 +39,19 @@
}
@e icon {
font-size: 16px;
width: 16px;
font-size: var(--alert-icon-size);
width: var(--alert-icon-size);
display: table-cell;
color: #fff;
color: var(--color-white);
vertical-align: middle;
@when big {
font-size: 28px;
width: 28px;
font-size: var(--alert-icon-large-size);
width: var(--alert-icon-large-size);
}
}
@e title {
font-size: 13px;
font-size: var(--alert-title-font-size);
line-height: 18px;
@when bold {
font-weight: bold;
@ -60,12 +60,12 @@
& .el-alert__description {
color: #fff;
font-size: 12px;
font-size: var(--alert-description-font-size-font-size);
margin: 5px 0 0 0;
}
@e closebtn {
font-size: 12px;
font-size: var(--alert-close-font-size);
color: #fff;
opacity: 1;
position: absolute 12px 15px * *;
@ -73,7 +73,7 @@
@when customed {
font-style: normal;
font-size: 13px;
font-size: var(--alert-close-customed-font-size);
top: 9px;
}
}

View File

@ -1,7 +1,6 @@
:root {
/*
Transition
/* Transition
-------------------------- */
--fade-transition: opacity 300ms cubic-bezier(0.23, 1, 0.32, 1);
--fade-linear-transition: opacity 200ms linear;
@ -33,11 +32,18 @@
--border-width-base: 1px;
--border-style-base: solid;
--border-color-base: var(--color-grey);
--border-color-hover: #8492a6;
--border-base: var(--border-width-base) var(--border-style-base) var(--border-color-base);
--border-radius-base: 4px;
--border-radius-small: 2px;
--border-radius-circle: 100%;
--shadow-base: 0 0 2px rgba(var(--color-black), 0.18), 0 0 1px var(--color-blue-light);
/* Box-shadow
-------------------------- */
--box-shadow-base: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
--box-shadow-dark: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .12);
/* Fill
-------------------------- */
--fill-base: var(--color-white);
@ -124,6 +130,105 @@
--radio-button-font-size: var(--font-size-base);
/* Select
-------------------------- */
--select-border-color-hover: var(--border-color-hover);
--select-disabled-border: var(--disabled-border-base);
--select-font-size: var(--font-size-base);
--select-close-hover-color: #99a9bf;
--select-input-color: var(--color-grey);
--select-multiple-input-color: #666;
--select-input-focus-background: #2ea0ff;
--select-input-font-size: 12px;
--select-tag-height: 24px;
--select-tag-color: var(--color-white);
--select-tag-background: var(--color-primary);
--select-option-color: #475669;
--select-option-disabled-color: var(--color-grey);
--select-option-height: 36px;
--select-option-hover-background: #e5e9f2;
--select-option-selected: var(--color-primary);
--select-option-selected-hover: #1D8CE0;
--select-group-color: #999;
--select-group-height: 30px;
--select-group-font-size: 12px;
--select-dropdown-background: var(--color-white);
--select-dropdown-shadow: var(--box-shadow-base);
--select-dropdown-empty-color: #999;
--select-dropdown-max-height: 274px;
--select-dropdown-padding: 6px 0;
--select-dropdown-empty-padding: 10px 0;
--select-dropdown-border: solid 1px #d3dce6;
/* Alert
-------------------------- */
--alert-padding: 8px 16px;
--alert-border-radius: var(--border-radius-base);
--alert-title-font-size: 13px;
--alert-description-font-size: 12px;
--alert-close-font-size: 12px;
--alert-close-customed-font-size: 13px;
--alert-success-color: var(--color-success);
--alert-info-color: var(--color-info);
--alert-warning-color: var(--color-warning);
--alert-danger-color: var(--color-danger);
--alert-icon-size: 16px;
--alert-icon-large-size: 28px;
/* Message Box
-------------------------- */
--msgbox-width: 420px;
--msgbox-border-radius: 3px;
--msgbox-font-size: 16px;
--msgbox-content-font-size: 14px;
--msgbox-content-color: #475669;
--msgbox-error-font-size: 12px;
--msgbox-success-color: var(--color-success);
--msgbox-info-color: var(--color-info);
--msgbox-warning-color: var(--color-warning);
--msgbox-danger-color: var(--color-danger);
/* Message
-------------------------- */
--message-shadow: var(--box-shadow-base);
--message-min-width: 300px;
--message-padding: 10px 12px;
--message-content-color: #8492a6;
--message-close-color: var(--color-grey);
--message-close-hover-color: #99A9BF;
--message-success-color: var(--color-success);
--message-info-color: var(--color-info);
--message-warning-color: var(--color-warning);
--message-danger-color: var(--color-danger);
/* Notification
-------------------------- */
--notification-width: 330px;
--notification-padding: 20px;
--notification-shadow: var(--box-shadow-base);
--notification-icon-size: 40px;
--notification-font-size: var(--font-size-base);
--notification-color: #8492a6;
--notification-title-font-size: 16px;
--notification-title-color: #1f2d3d;
--notification-close-color: var(--color-grey);
--notification-close-hover-color: #99A9BF;
--notification-success-color: var(--color-success);
--notification-info-color: var(--color-info);
--notification-warning-color: var(--color-warning);
--notification-danger-color: var(--color-danger);
/* Input
-------------------------- */
--input-font-size: var(--font-size-base);
@ -134,7 +239,7 @@
--input-border: var(--border-base);
--input-border-color: var(--border-color-base);
--input-border-radius: var(--border-radius-base);
--input-border-color-hover: #8492A6;
--input-border-color-hover: var(--border-color-hover);
--input-fill: #fff;
--input-fill-disabled: var(--disabled-fill-base);
--input-color-disabled: var(--font-color-disabled-base);
@ -142,7 +247,7 @@
--input-placeholder-color: #99a9bf;
--input-max-width: 314px;
--input-hover-border: #8492A6;
--input-hover-border: var(--border-color-hover);
--input-focus-border: var(--color-primary);
--input-focus-fill: #fff;
@ -182,13 +287,6 @@
--cascader-menu-option-pinyin-color: #999;
--cascader-menu-submenu-shadow: 1px 1px 2px rgba(var(--color-black), 0.14), 1px 0 2px rgba(var(--color-black), 0.14);
/* Tag
-------------------------- */
--tag-color: var(--font-color-base);
--tag-fill: #e2e2e2;
--tag-border-radius: var(--border-radius-base);
--tag-close-color: #666;
/* Group
-------------------------- */
--group-option-flex: 0 0 (1/5) * 100%;
@ -279,10 +377,23 @@
--switch-disabled-color: #E5E9F3;
--switch-disabled-text-color: #F9FAFC;
--switch-font-size: var(--font-size-base);
--switch-core-border-radius: 12px;
--switch-size: 46px 22px;
--switch-button-size: 16px;
/* Dialog
-------------------------- */
--dialog-background-color: var(--color-blue);
--dialog-footer-background: var(--color-blue-lighter);
--dialog-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
--dialog-tiny-width: 30%;
--dialog-small-width: 50%;
--dialog-large-width: 90%;
--dialog-close-color: var(--color-grey);
--dialog-close-hover-color: var(--color-primary);
--dialog-title-font-size: 16px;
--dialog-font-size: 14px;
/* Table
-------------------------- */
@ -297,7 +408,6 @@
--pagination-color: #475669;
--pagination-border-radius: 2px;
--pagination-button-color: #99a9bf;
--pagination-button-disabled-color: #D3DCE6;
--pagination-button-size: 28px;
--pagination-button-disabled-color: #e4e4e4;
--pagination-button-disabled-fill: var(--color-white);
@ -316,7 +426,7 @@
--popover-title-color: #1f2d3d;
/* Tooltip
-------------------------- */
-------------------------- */
--tooltip-fill: #1f2d3d;
--tooltip-color: #fff;
--tooltip-font-size: 12px;
@ -325,77 +435,93 @@
--tooltip-padding: 10px;
/* Tag
-------------------------- */
--tag-padding: 0 5px;
--tag-fill: #8492a6;
--tag-border: #8492a6;
--tag-color: #fff;
--tag-font-size: 12px;
--tag-border-radius: 4px;
-------------------------- */
--tag-padding: 0 5px;
--tag-fill: #8492a6;
--tag-border: #8492a6;
--tag-color: #fff;
--tag-close-color: #666;
--tag-font-size: 12px;
--tag-border-radius: 4px;
--tag-gray-fill: #e5e9f2;
--tag-gray-border: #e5e9f2;
--tag-gray-color: #475669;
--tag-gray-fill: #e5e9f2;
--tag-gray-border: #e5e9f2;
--tag-gray-color: #475669;
--tag-primary-fill: rgba(32,159,255,0.10);
--tag-primary-border: rgba(32,159,255,0.20);
--tag-primary-color: #20a0ff;
--tag-primary-fill: rgba(32,159,255,0.10);
--tag-primary-border: rgba(32,159,255,0.20);
--tag-primary-color: #20a0ff;
--tag-success-fill: rgba(18,206,102,0.10);
--tag-success-border: rgba(18,206,102,0.20);
--tag-success-color: #13ce66;
--tag-success-fill: rgba(18,206,102,0.10);
--tag-success-border: rgba(18,206,102,0.20);
--tag-success-color: #13ce66;
--tag-warning-fill: rgba(247,186,41,0.10);
--tag-warning-border: rgba(247,186,41,0.20);
--tag-warning-color: #f7ba2a;
--tag-warning-fill: rgba(247,186,41,0.10);
--tag-warning-border: rgba(247,186,41,0.20);
--tag-warning-color: #f7ba2a;
--tag-danger-fill: rgba(255,73,73,0.10);
--tag-danger-border: rgba(255,73,73,0.20);
--tag-danger-color: #ff4949;
--tag-danger-fill: rgba(255,73,73,0.10);
--tag-danger-border: rgba(255,73,73,0.20);
--tag-danger-color: #ff4949;
/* Dropdown
-------------------------- */
--dropdown-menu-box-shadow: 0 0 6px 0 rgba(0,0,0,.12), 0 2px 4px 0 rgba(0,0,0,.12);
--dropdown-menuItem-hover-fill: #e5e9f2;
--dropdown-menuItem-hover-color: #475669;
-------------------------- */
--dropdown-menu-box-shadow: var(--box-shadow-dark);
--dropdown-menuItem-hover-fill: #e5e9f2;
--dropdown-menuItem-hover-color: #475669;
/* Badge
-------------------------- */
--badge-fill: var(--color-danger);
--badge-radius: 10px;
--badge-font-size: 12px;
--badge-padding: 6px;
--badge-size: 18px;
-------------------------- */
--badge-fill: var(--color-danger);
--badge-radius: 10px;
--badge-font-size: 12px;
--badge-padding: 6px;
--badge-size: 18px;
/*Card
--------------------------*/
--card-border-color: var(--disabled-border-base);
--card-border-radius: 4px;
--card-padding: 20px;
/* Card
--------------------------*/
--card-border-color: var(--disabled-border-base);
--card-border-radius: 4px;
--card-padding: 20px;
/*Slider
--------------------------*/
/* Slider
--------------------------*/
--slider-main-background-color: var(--color-primary);
--slider-runway-background-color: #e5e9f2;
--slider-button-hover-color: #1d8ce0;
--slider-stop-background-color: #c0ccda;
--slider-disable-color: #c0ccda;
--slider-stop-background-color: var(--color-grey);
--slider-disable-color: var(--color-grey);
/*Steps
--------------------------*/
--steps-border-color: var(--disabled-border-base);
--steps-border-radius: 4px;
--steps-padding: 20px;
--slider-margin: 20px 0;
--slider-border-radius: 3px;
--slider-height: 4px;
--slider-button-size: 12px;
--slider-button-wrapper-size: 36px;
--slider-button-wrapper-offset: -16px;
/*Steps
--------------------------*/
--menu-item-color: #475669;
--menu-item-fill: #eff2f7;
--menu-item-hover-fill: #d3dce6;
--submenu-item-fill: #e5e9f2;
/* Steps
--------------------------*/
--steps-border-color: var(--disabled-border-base);
--steps-border-radius: 4px;
--steps-padding: 20px;
--dark-menu-item-color: #475669;
--dark-menu-item-fill: #324057;
--dark-menu-item-hover-fill: #475669;
--dark-submenu-item-fill: #1f2d3d;
/* Steps
--------------------------*/
--menu-item-color: #475669;
--menu-item-fill: #eff2f7;
--menu-item-hover-fill: #d3dce6;
--submenu-item-fill: #e5e9f2;
--dark-menu-item-color: #475669;
--dark-menu-item-fill: #324057;
--dark-menu-item-hover-fill: #475669;
--dark-submenu-item-fill: #1f2d3d;
/* Rate
--------------------------*/
--rate-height: 20px;
--rate-font-size: var(--font-size-base);
--rate-icon-size: 18px;
--rate-icon-margin: 6px;
--rate-icon-color: #C6D1DE;
}

View File

@ -9,20 +9,20 @@
left: 50%;
transform: translateX(-50%);
background: #fff;
border-radius: 2px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
border-radius: var(--border-radius-small);
box-shadow: var(--dialog-box-shadow);
box-sizing: border-box;
@modifier tiny {
width: 30%;
width: var(--dialog-tiny-width);
}
@modifier small {
width: 50%;
width: var(--dialog-small-width);
}
@modifier large {
width: 90%;
width: var(--dialog-large-width);
}
@modifier full {
@ -44,16 +44,16 @@
@e close {
cursor: pointer;
color: #C0CCDA;
color: var(--dialog-close-color);
&:hover {
color: var(--color-primary);
color: var(--dialog-close-hover-color);
}
}
@e title {
line-height: 1;
font-size: 16px;
font-size: var(--dialog-title-font-size);
font-weight: bold;
color: #1f2d3d;
}
@ -61,7 +61,7 @@
@e body {
padding: 30px 20px;
color: #475669;
font-size: 14px;
font-size: var(--dialog-font-size);
}
@e headerbtn {

View File

@ -12,9 +12,9 @@
left: 50%;
transform: translate3d(-50%, -50%, 0);
background-color: #fff;
width: 420px;
border-radius: 3px;
font-size: 16px;
width: var(--msgbox-width);
border-radius: var(--msgbox-border-radius);
font-size: var(--msgbox-font-size);
-webkit-user-select: none;
overflow: hidden;
backface-visibility: hidden;
@ -25,8 +25,8 @@
@e content {
padding: 30px 20px;
color: #475669;
font-size: 14px;
color: var(--msgbox-content-color);
font-size: var(--msgbox-content-font-size);
position: relative;
}
@ -48,16 +48,16 @@
@e input {
padding-top: 15px;
& input.invalid {
border-color: #ff4949;
border-color: var(--color-danger);
&:focus {
border-color: #ff4949;
border-color: var(--color-danger);
}
}
}
@e errormsg {
color: red;
font-size: 12px;
color: var(--color-danger);
font-size: var(--msgbox-error-font-size);
min-height: 18px;
margin-top: 2px;
}
@ -65,7 +65,7 @@
@e title {
padding-left: 0;
margin-bottom: 0;
font-size: 16px;
font-size: var(--msgbox-font-size);
font-weight: bold;
height: 18px;
color: #333;
@ -100,19 +100,19 @@
font-size: 36px !important;
&.el-icon-circle-check {
color: #13ce66;
color: var(--msgbox-success-color);
}
&.el-icon-information {
color: #50bfff;
color: var(--msgbox-info-color);
}
&.el-icon-warning {
color: #f7ba2a;
color: var(--msgbox-warning-color);
}
&.el-icon-circle-cross {
color: #ff4949;
color: var(--msgbox-error-color);
}
}
}

View File

@ -4,11 +4,11 @@
@component-namespace el {
@b message {
box-shadow:0 2px 4px 0 rgba(0, 0, 0, .12), 0 0 6px 0 rgba(0, 0, 0, .04);
min-width: 300px;
padding: 10px 12px;
box-shadow: var(--message-shadow);
min-width: var(--message-min-width);
padding: var(--message-padding);
box-sizing: border-box;
border-radius: 2px;
border-radius: var(--border-radius-small);
position: fixed;
left: 50%;
top: 20px;
@ -23,11 +23,11 @@
position: relative;
& p {
font-size: 14px;
font-size: var(--font-size-base);
line-height: 20px;
margin: 0 34px 0 0;
white-space: nowrap;
color: #8492a6;
color: var(--message-content-color);
text-align: justify;
}
}
@ -42,28 +42,28 @@
@e closeBtn {
position: absolute 3px 0 * *;
cursor: pointer;
color: #C0CCDA;
font-size: 14px;
color: var(--message-close-color);
font-size: var(--font-size-base);
&:hover {
color: #99A9BF;
color: var(--message-close-hover-color);
}
}
& .el-icon-circle-check {
color: #13ce66;
color: var(--message-success-color);
}
& .el-icon-circle-cross {
color: #ff4949;
color: var(--message-danger-color);
}
& .el-icon-information {
color: #50bfff;
color: var(--message-info-color);
}
& .el-icon-warning {
color: #f7ba2a;
color: var(--message-warning-color);
}
}

View File

@ -4,36 +4,36 @@
@component-namespace el {
@b notification {
width: 330px;
padding: 20px;
width: var(--notification-width);
padding: var(--notification-padding);
box-sizing: border-box;
border-radius: 2px;
border-radius: var(--border-radius-small);
position: fixed;
right: 16px;
background-color: #fff;
box-shadow: 0 0 6px rgba(0, 0, 0, .04), 0 2px 4px rgba(0, 0, 0, .12);
box-shadow: var(--notification-shadow);
transition: opacity 0.3s, transform .3s, right .3s, top 0.4s;
overflow: hidden;
z-index: var(--index-popper);
@e group {
& span {
font-size: 16px;
color: #1f2d3d;
font-size: var(--notification-title-font-size);
color: var(--notification-title-color);
}
& p {
font-size: 14px;
font-size: var(--notification-font-size);
line-height: 21px;
margin: 10px 0 0 0;
color: #8492a6;
color: var(--notification-color);
text-align: justify;
}
}
@e icon {
size: 40px;
font-size: 40px;
size: var(--notification-icon-size);
font-size: var(--notification-icon-size);
float: left;
position: relative;
top: 3px;
@ -42,28 +42,28 @@
@e closeBtn {
position: absolute 20px 20px * *;
cursor: pointer;
color: #C0CCDA;
font-size: 14px;
color: var(--notification-close-color);
font-size: var(--notification-font-size);
&:hover {
color: #99A9BF;
color: var(--notification-close-hover-color);
}
}
& .el-icon-circle-check {
color: #13ce66;
color: var(--notification-success-color);
}
& .el-icon-circle-cross {
color: #ff4949;
color: var(--notification-danger-color);
}
& .el-icon-information {
color: #50bfff;
color: var(--notification-info-color);
}
& .el-icon-warning {
color: #f7ba2a;
color: var(--notification-warning-color);
}
}

View File

@ -15,10 +15,10 @@
@e title {
padding-left: 10px;
font-size: 12px;
color: #999;
height: 30px;
line-height: 30px;
font-size: var(--select-group-font-size);
color: var(--select-group-color);
height: var(--select-group-height);
line-height: var(--select-group-height);
}
& .el-select-dropdown__item {

View File

@ -5,37 +5,37 @@
@b select-dropdown {
@e item {
font-size: 14px;
font-size: var(--select-font-size);
padding: 8px 10px;
position: relative;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #475669;
height: 36px;
color: var(--select-option-color);
height: var(--select-option-height);
line-height: 1.5;
box-sizing: border-box;
cursor: pointer;
@when disabled {
color: #c0ccda;
color: var(--select-option-disabled-color);
cursor: not-allowed;
&:hover {
background-color: #fff;
background-color: var(--color-white);
}
}
&.hover {
background-color: #e5e9f2;
background-color: var(--select-option-hover-background);
}
&.selected {
color: #fff;
background-color: #20A0FF;
color: var(--color-white);
background-color: var(--select-option-selected);
&.hover {
background-color: #1D8CE0;
background-color: var(--select-option-selected-hover);
}
}

View File

@ -4,7 +4,7 @@
@component-namespace el {
@b rate {
height: 20px;
height: var(--rate-height);
@e item {
display: inline-block;
position: relative;
@ -15,9 +15,9 @@
@e icon {
position: relative;
display: inline-block;
font-size: 18px;
margin-right: 6px;
color: #C6D1DE;
font-size: var(--rate-icon-size);
margin-right: var(--rate-icon-margin);
color: var(--rate-icon-color);
transition: .3s;
&.hover {
transform: scale(1.15);
@ -39,7 +39,7 @@
}
@e text {
font-size: 14px;
font-size: var(--rate-font-size);
vertical-align: middle;
}
}

View File

@ -6,20 +6,20 @@
@b select-dropdown {
position: absolute;
z-index: 1001;
border: solid 1px #d3dce6;
border-radius: 2px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
border: var(--select-dropdown-border);
border-radius: var(--border-radius-small);
background-color: var(--select-dropdown-background);
box-shadow: var(--select-dropdown-shadow);
box-sizing: border-box;
margin: 5px 0;
@when multiple {
& .el-select-dropdown__item.selected {
color: #20A0FF;
background-color: #fff;
color: var(--select-option-selected);
background-color: var(--select-dropdown-background);
&.hover {
background-color: #E5E9F2;
background-color: var(--select-option-hover-background);
}
&::after {
@ -36,19 +36,19 @@
}
@b select-dropdown__empty {
padding: 10px 0;
padding: var(--select-dropdown-empty-padding);
margin: 0;
text-align: center;
color: #999;
font-size: 14px;
color: var(--select-dropdown-empty-color);
font-size: var(--select-font-size);
}
@b select-dropdown__list {
list-style: none;
padding: 6px 0;
padding: var(--select-dropdown-padding);
margin: 0;
width: 100%;
max-height: 274px;
max-height: var(--select-dropdown-max-height);
box-sizing: border-box;
overflow-y: auto;
}

View File

@ -14,21 +14,21 @@
@when small {
& input {
border-radius: 2px;
border-radius: var(--border-radius-small);
height: 28px;
}
}
&:hover {
.el-input__inner {
border-color: #8492a6;
border-color: var(--select-border-color-hover);
}
}
& .el-input {
& .el-input__icon {
color: #c0ccda;
font-size: 12px;
color: var(--select-input-color);
font-size: var(--select-input-font-size);
transition: transform .3s;
transform: translateY(-50%) rotateZ(180deg);
line-height: 16px;
@ -42,15 +42,15 @@
@when show-close {
transition: 0s;
size: 16px;
font-size: 14px;
font-size: var(--select-font-size);
right: 8px;
text-align: center;
transform: translateY(-50%) rotateZ(180deg);
border-radius: 50%;
color: #C0CCDA;
border-radius: var(--border-radius-circle);
color: var(--select-input-color);
&:hover {
color: #99A9BF;
color: var(--select-close-hover-color);
}
}
}
@ -59,7 +59,7 @@
cursor: pointer;
&:focus {
border-color: #2ea0ff;
border-color: var(--select-input-focus-background);
}
}
@ -68,7 +68,7 @@
cursor: not-allowed;
&:hover {
border-color: #D3DCE6;
border-color: var(--select-disabled-border);
}
}
}
@ -79,8 +79,8 @@
outline: none;
padding: 0;
margin: 4px 0 -3px 10px;
color: #666;
font-size: 14px;
color: var(--select-multiple-input-color);
font-size: var(--select-font-size);
vertical-align: baseline;
appearance: none;
height: 28px;
@ -93,12 +93,12 @@
top: 8px;
z-index: var(--index-top);
right: 25px;
color: #c0ccda;
color: var(--select-input-color);
line-height: 18px;
font-size: 12px;
font-size: var(--select-input-font-size);
&:hover {
color: #99A9BF;
color: var(--select-close-hover-color);
}
}
@ -114,23 +114,23 @@
}
& .el-tag {
height: 24px;
line-height: 24px;
height: var(--select-tag-height);
line-height: var(--select-tag-height);
box-sizing: border-box;
margin: 6px 0 0 6px;
}
@e tag {
display: inline-block;
height: 24px;
line-height: 24px;
font-size: 14px;
border-radius: 4px;
color: #fff;
background-color: #20a0ff;
height: var(--select-tag-height);
line-height: var(--select-tag-height);
font-size: var(--select-font-size);
border-radius: var(--border-radius-base);
color: var(--select-tag-color);
background-color: var(--select-tag-background);
& .el-icon-close {
font-size: 12px;
font-size: var(--select-input-font-size);
}
}
}

View File

@ -8,10 +8,10 @@
@utils-clearfix;
@e runway {
width: 100%;
height: 4px;
margin: 20px 0;
height: var(--slider-height);
margin: var(--slider-margin);
background-color: var(--slider-runway-background-color);
border-radius: 3px;
border-radius: var(--slider-border-radius);
position: relative;
cursor: pointer;
vertical-align: middle;
@ -64,18 +64,18 @@
}
@e bar {
height: 4px;
height: var(--slider-height);
background-color: var(--slider-main-background-color);
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
border-top-left-radius: var(--slider-border-radius);
border-bottom-left-radius: var(--slider-border-radius);
position: absolute;
}
@e button-wrapper {
size: 36px;
size: var(--slider-button-wrapper-size);
position: absolute;
z-index: 1001;
top: -16px;
top: var(--slider-button-wrapper-offset);
transform: translateX(-50%);
background-color: transparent;
text-align: center;
@ -95,7 +95,7 @@
}
@e button {
size: 12px;
size: var(--slider-button-size);
background-color: var(--slider-main-background-color);
border-radius: 50%;
transition: .2s;
@ -119,8 +119,8 @@
@e stop {
position: absolute;
size: 4px;
border-radius: 50%;
size: var(--slider-height);
border-radius: var(--border-radius-circle);
background-color: var(--slider-stop-background-color);
transform: translateX(-50%);
}

View File

@ -6,8 +6,7 @@
@b switch {
display: inline-block;
position: relative;
line-height: 20px;
font-size: 14px;
font-size: var(--switch-font-size);
@when disabled {
& .el-switch__core,
& .el-switch__label {
@ -19,11 +18,11 @@
transition: .2s;
position: absolute;
z-index: 10;
size: 46px 22px;
size: var(--switch-size);
left: 0;
top: 0;
display: inline-block;
font-size: 14px;
font-size: var(--switch-font-size);
cursor: pointer;
user-select: none;
@m left {
@ -40,7 +39,7 @@
line-height: 1;
top: 4px;
position: absolute;
font-size: 14px;
font-size: var(--switch-font-size);
display: inline-block;
color: var(--color-white);
}
@ -58,10 +57,10 @@
display: inline-block;
vertical-align: middle;
position: relative;
size: 46px 22px;
size: var(--switch-size);
border: 1px solid var(--switch-off-color);
outline: none;
border-radius: 12px;
border-radius: var(--switch-core-border-radius);
box-sizing: border-box;
background: var(--switch-off-color);
cursor: pointer;
@ -69,9 +68,9 @@
& .el-switch__button {
position: absolute 0 * * 0;
border-radius: 15px;
border-radius: var(--border-radius-circle);
transition: transform .3s;
size: 16px;
size: var(--switch-button-size);
z-index: 20;
background-color: var(--color-white);
}

View File

@ -4,7 +4,7 @@ export default {
now: 'jetzt',
today: 'heute',
cancel: 'abbrechen',
// clear: 'leeren',
clear: 'leeren',
confirm: 'OK',
selectDate: 'Datum wählen',
selectTime: 'Zeit wählen',

View File

@ -4,7 +4,7 @@ export default {
now: 'Now',
today: 'Today',
cancel: 'Cancel',
// clear: 'Clear',
clear: 'Clear',
confirm: 'OK',
selectDate: 'Select date',
selectTime: 'Select time',

View File

@ -4,7 +4,7 @@ export default {
now: '此刻',
today: '今天',
cancel: '取消',
// clear: '清空',
clear: '清空',
confirm: '确定',
selectDate: '选择日期',
selectTime: '选择时间',

View File

@ -1,4 +1,4 @@
import { createVue, triggerEvent } from '../util';
import { createVue, triggerEvent, destroyVM } from '../util';
describe('Dropdown', () => {
it('create', done => {
@ -29,6 +29,7 @@ describe('Dropdown', () => {
triggerEvent(triggerElm, 'mouseleave');
setTimeout(_ => {
expect(dropdown.visible).to.not.true;
destroyVM(vm);
done();
}, 300);
}, 400);
@ -36,43 +37,37 @@ describe('Dropdown', () => {
it('menu click', done => {
const vm = createVue({
template: `
<el-dropdown>
<el-dropdown ref="dropdown">
<span class="el-dropdown-link">
下拉菜单<i class="el-icon-caret-bottom el-icon-right"></i>
</span>
<el-dropdown-menu slot="dropdown" class="dropdown-test-menu-click">
<el-dropdown-item>黄金糕</el-dropdown-item>
<el-dropdown-item @click.native="handleClick">狮子头</el-dropdown-item>
<el-dropdown-item>螺蛳粉</el-dropdown-item>
<el-dropdown-item>双皮奶</el-dropdown-item>
<el-dropdown-item>蚵仔煎</el-dropdown-item>
<el-dropdown-item command="a">黄金糕</el-dropdown-item>
<el-dropdown-item command="b">狮子头</el-dropdown-item>
<el-dropdown-item ref="commandC" command="c">螺蛳粉</el-dropdown-item>
<el-dropdown-item command="d">双皮奶</el-dropdown-item>
<el-dropdown-item command="e">蚵仔煎</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
`,
data() {
return {
clickedItem: ''
};
},
methods: {
handleClick(ev) {
this.clickedItem = ev.target.innerText;
}
}
`
}, true);
let dropdownElm = vm.$el;
let dropdown = vm.$refs.dropdown;
let dropdownElm = dropdown.$el;
let triggerElm = dropdownElm.children[0];
let callback = sinon.spy();
dropdown.$on('command', callback);
triggerEvent(triggerElm, 'mouseenter');
setTimeout(_ => {
let dropdownMenu = document.querySelector('.dropdown-test-menu-click');
dropdownMenu.children[1].click();
vm.$refs.commandC.$el.click();
setTimeout(_ => {
expect(dropdownMenu.style.display).to.be.equal('none');
expect(vm.clickedItem).to.be.equal('狮子头');
expect(dropdown.visible).to.not.true;
expect(callback.calledWith('c')).to.be.true;
destroyVM(vm);
done();
}, 600);
}, 400);
}, 300);
}, 300);
});
it('trigger', done => {
const vm = createVue({
@ -89,17 +84,7 @@ describe('Dropdown', () => {
<el-dropdown-item>蚵仔煎</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
`,
data() {
return {
clickedItem: ''
};
},
methods: {
handleClick(ev) {
this.clickedItem = ev.target.innerText;
}
}
`
}, true);
let dropdownElm = vm.$el;
let dropdown = vm.$refs.dropdown;
@ -109,9 +94,10 @@ describe('Dropdown', () => {
dropdown.$nextTick(_ => {
expect(dropdown.visible).to.not.true;
dropdownElm.children[0].click();
triggerElm.click();
dropdown.$nextTick(_ => {
expect(dropdown.visible).to.be.true;
destroyVM(vm);
done();
});
});
@ -119,7 +105,7 @@ describe('Dropdown', () => {
it('split button', done => {
const vm = createVue({
template: `
<el-dropdown split-button type="primary" @click="handleClick" ref="dropdown">
<el-dropdown split-button type="primary" ref="dropdown">
更多菜单
<el-dropdown-menu slot="dropdown" class="dropdown-test-split-button">
<el-dropdown-item>黄金糕</el-dropdown-item>
@ -129,22 +115,20 @@ describe('Dropdown', () => {
<el-dropdown-item>蚵仔煎</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
`,
data() {
return {
btnClicked: false
};
},
methods: {
handleClick(ev) {
this.btnClicked = true;
}
}
`
}, true);
let dropdown = vm.$refs.dropdown;
let dropdownElm = dropdown.$el;
let triggerElm = dropdownElm.querySelector('.el-dropdown__caret-button');
var callback = sinon.spy();
dropdown.$on('click', callback);
dropdownElm.querySelector('.el-button').click();
setTimeout(_ => {
expect(callback.called).to.be.true;
}, 300);
triggerEvent(triggerElm, 'mouseenter');
setTimeout(_ => {
@ -153,8 +137,9 @@ describe('Dropdown', () => {
triggerEvent(triggerElm, 'mouseleave');
setTimeout(_ => {
expect(dropdown.visible).to.not.true;
destroyVM(vm);
done();
}, 400);
}, 400);
}, 300);
}, 300);
});
});