mirror of https://github.com/ElemeFE/element
Merge branch 'next' of github.com:eleme/element-ui into next
# Conflicts: # bin/build-entry.js # src/index.jspull/2/head
commit
609901ae7a
|
@ -1,7 +1,4 @@
|
|||
{
|
||||
"group": [
|
||||
"./packages/group/index.js"
|
||||
],
|
||||
"select-dropdown": [
|
||||
"./packages/select-dropdown/index.js"
|
||||
],
|
||||
|
|
|
@ -41,22 +41,26 @@
|
|||
### 多个勾选框,绑定到同一个数组
|
||||
|
||||
<div class="demo-box demo-checkbox">
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="复选框 A"></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="复选框 B"></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="复选框 C"></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="禁用" disabled></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="选中且禁用" disabled></el-checkbox>
|
||||
<el-checkbox-group v-model="checkList">
|
||||
<el-checkbox class="checkbox" label="复选框 A"></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="复选框 B"></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="复选框 C"></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="禁用" disabled></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="选中且禁用" disabled></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
|
||||
<p>{{ checkList }}</p>
|
||||
|
||||
```html
|
||||
<template>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="复选框 A"></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="复选框 B"></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="复选框 C"></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="禁用" disabled></el-checkbox>
|
||||
<el-checkbox class="checkbox" v-model="checkList" label="选中且禁用" disabled></el-checkbox>
|
||||
<el-checkbox-group v-model="checkList">
|
||||
<el-checkbox class="checkbox" label="复选框 A"></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="复选框 B"></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="复选框 C"></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="禁用" disabled></el-checkbox>
|
||||
<el-checkbox class="checkbox" label="选中且禁用" disabled></el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -101,10 +105,21 @@ vm.name === vm.a
|
|||
vm.name === vm.b
|
||||
```
|
||||
|
||||
## API
|
||||
## checkbox API
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| model | 绑定值 | string\|string[]\|boolean | | |
|
||||
| value | 真实值 | string | | |
|
||||
| label | 显示值,不填则显示 value | string | | |
|
||||
| value | 绑定值 | string\|string[]\|boolean | | |
|
||||
| label | 真实值 | string | | |
|
||||
| true-label | 选中时的真实值 | string | | |
|
||||
| true-label | 没有选中时的真实值 | string | | |
|
||||
| disabled | 禁用 | boolean | true, false | false |
|
||||
|
||||
## checkbox group API
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| value | 绑定值 | string\|string[]\|boolean | | |
|
||||
|
||||
## checkbox group 事件
|
||||
| 事件名称 | 说明 | 回调参数 |
|
||||
|---------- |-------- |---------- |
|
||||
| change | 当绑定值变化时触发的事件 | (value: string) |
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
|
||||
|
||||
<el-pagination
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
@sizechange="handleSizeChange"
|
||||
@currentchange="handleCurrentChange"
|
||||
layout="sizes, prev, pager, next, jumper, total"
|
||||
:total="1000">
|
||||
</el-pagination>
|
||||
|
@ -85,6 +85,10 @@
|
|||
| current-page | 当前页数 | Number | | 0|
|
||||
| layout | 组件布局,子组件名用逗号分隔。| String | `prev`, `pager`, `next`, `jumper`, `slot`, `->`, `total` | 'prev, pager, next, jumper, slot, ->, total' |
|
||||
| page-sizes | 切换每页显示个数的子组件值 | Number[] | | [10, 20, 30, 40, 50, 100] |
|
||||
| size-change | pageSize 改变时会触发的事件 | Function | | |
|
||||
| current-change | currentPage 改变时会触发的事件 | Function | | |
|
||||
|
||||
## 事件
|
||||
| 事件名称 | 说明 | 回调函数 |
|
||||
|---------|--------|---------|
|
||||
| sizechange | pageSize 改变时会触发 | `size` |
|
||||
| currentchange | currentPage 改变时会触发 | `currentPage` |
|
||||
|
||||
|
|
|
@ -16,16 +16,16 @@
|
|||
## 基本用法
|
||||
|
||||
<div class="demo-box demo-radio">
|
||||
<el-radio class="radio" :value.sync="radio" label="单选框 A"></el-radio>
|
||||
<el-radio class="radio" :value.sync="radio" label="单选框 B"></el-radio>
|
||||
<el-radio class="radio" :value.sync="radio" label="单选框 C"></el-radio>
|
||||
<el-radio class="radio" v-model="radio" label="单选框 A"></el-radio>
|
||||
<el-radio class="radio" v-model="radio" label="单选框 B"></el-radio>
|
||||
<el-radio class="radio" v-model="radio" label="单选框 C"></el-radio>
|
||||
</div>
|
||||
|
||||
```html
|
||||
<template>
|
||||
<el-radio class="radio" :value.sync="radio" label="单选框 A"></el-radio>
|
||||
<el-radio class="radio" :value.sync="radio" label="单选框 B"></el-radio>
|
||||
<el-radio class="radio" :value.sync="radio" label="单选框 C"></el-radio>
|
||||
<el-radio class="radio" v-model="radio" label="单选框 A"></el-radio>
|
||||
<el-radio class="radio" v-model="radio" label="单选框 B"></el-radio>
|
||||
<el-radio class="radio" v-model="radio" label="单选框 C"></el-radio>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
@ -42,7 +42,7 @@
|
|||
## Radio Group
|
||||
|
||||
<div class="demo-box demo-radio">
|
||||
<el-radio-group :value.sync="radio2">
|
||||
<el-radio-group v-model="radio2">
|
||||
<el-radio :label="9"></el-radio>
|
||||
<el-radio :label="6"></el-radio>
|
||||
<el-radio :label="3"></el-radio>
|
||||
|
@ -50,7 +50,7 @@
|
|||
</div>
|
||||
|
||||
```html
|
||||
<el-radio-group :value.sync="radio2">
|
||||
<el-radio-group v-model="radio2">
|
||||
<el-radio :label="9"></el-radio>
|
||||
<el-radio :label="6"></el-radio>
|
||||
<el-radio :label="3"></el-radio>
|
||||
|
@ -60,7 +60,7 @@
|
|||
## Radio Group Button
|
||||
|
||||
<div class="demo">
|
||||
<el-radio-group :value.sync="radio31" size="large">
|
||||
<el-radio-group v-model="radio31" size="large">
|
||||
<el-radio-button label="上海"></el-radio-button>
|
||||
<el-radio-button label="北京"></el-radio-button>
|
||||
<el-radio-button label="广州" :disabled="true"></el-radio-button>
|
||||
|
@ -68,7 +68,7 @@
|
|||
</el-radio-group>
|
||||
</div>
|
||||
<div class="demo">
|
||||
<el-radio-group :value.sync="radio32">
|
||||
<el-radio-group v-model="radio32">
|
||||
<el-radio-button label="上海"></el-radio-button>
|
||||
<el-radio-button label="北京"></el-radio-button>
|
||||
<el-radio-button label="广州" :disabled="true"></el-radio-button>
|
||||
|
@ -76,7 +76,7 @@
|
|||
</el-radio-group>
|
||||
</div>
|
||||
<div class="demo">
|
||||
<el-radio-group :value.sync="radio33" size="small">
|
||||
<el-radio-group v-model="radio33" size="small">
|
||||
<el-radio-button label="上海"></el-radio-button>
|
||||
<el-radio-button label="北京"></el-radio-button>
|
||||
<el-radio-button label="广州" :disabled="true"></el-radio-button>
|
||||
|
@ -85,19 +85,19 @@
|
|||
</div>
|
||||
|
||||
```html
|
||||
<el-radio-group :value.sync="radio31" size="large">
|
||||
<el-radio-group v-model="radio31" size="large">
|
||||
<el-radio-button label="上海"></el-radio-button>
|
||||
<el-radio-button label="北京"></el-radio-button>
|
||||
<el-radio-button label="广州" :disabled="true"></el-radio-button>
|
||||
<el-radio-button label="深圳"></el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-radio-group :value.sync="radio32">
|
||||
<el-radio-group v-model="radio32">
|
||||
<el-radio-button label="上海"></el-radio-button>
|
||||
<el-radio-button label="北京"></el-radio-button>
|
||||
<el-radio-button label="广州" :disabled="true"></el-radio-button>
|
||||
<el-radio-button label="深圳"></el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-radio-group :value.sync="radio33" size="small">
|
||||
<el-radio-group v-model="radio33" size="small">
|
||||
<el-radio-button label="上海"></el-radio-button>
|
||||
<el-radio-button label="北京"></el-radio-button>
|
||||
<el-radio-button label="广州" :disabled="true"></el-radio-button>
|
||||
|
@ -108,31 +108,32 @@
|
|||
## 禁用
|
||||
|
||||
<div class="demo-box demo-radio">
|
||||
<el-radio disabled :value.sync="radio" label="禁用"></el-radio>
|
||||
<el-radio disabled :value.sync="radio1" label="选中且禁用"></el-radio>
|
||||
<el-radio disabled v-model="radio" label="禁用"></el-radio>
|
||||
<el-radio disabled v-model="radio1" label="选中且禁用"></el-radio>
|
||||
</div>
|
||||
|
||||
```html
|
||||
<el-radio disabled :value.sync="radio" label="禁用"></el-radio>
|
||||
<el-radio disabled :value.sync="radio1" label="选中且禁用"></el-radio>
|
||||
<el-radio disabled v-model="radio" label="禁用"></el-radio>
|
||||
<el-radio disabled v-model="radio1" label="选中且禁用"></el-radio>
|
||||
```
|
||||
|
||||
|
||||
## Radio API
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| value | 绑定值 | string | | |
|
||||
| label | 真实值 | string | | |
|
||||
| value | 绑定值 | string,number | | |
|
||||
| label | 真实值 | string,number | | |
|
||||
| disabled | 禁用 | boolean | true, false | false |
|
||||
|
||||
## Radio Group API
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| value | 绑定值 | string | | |
|
||||
| value | 绑定值 | string,number | | |
|
||||
| size | 尺寸 | string | large, small | |
|
||||
| change | 绑定值变化时触发的事件 | Function(value) | | |
|
||||
|
||||
## Radio Button API
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| label | 真实值 | string | | |
|
||||
| label | 真实值 | string,number | | |
|
||||
| disabled | 禁用 | boolean | true, false | false |
|
||||
|
|
|
@ -779,7 +779,11 @@
|
|||
| remote | 是否为远程搜索 | boolean | | false |
|
||||
| remote-method | 远程搜索方法,当搜索关键字变化时会调用该方法,参数为目前的搜索关键字 | function | | |
|
||||
| loading | 是否正在从远程获取数据 | boolean | | false |
|
||||
| change | value 发生变化时的回调函数,参数为 value 的值 | function | | |
|
||||
|
||||
### el-select 事件
|
||||
| 事件名称 | 说明 | 回调参数 |
|
||||
|---------|---------|---------|
|
||||
| change | value 发生变化| `value` |
|
||||
|
||||
### el-option-group
|
||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
title: '选项卡四',
|
||||
content: '选项卡四内容'
|
||||
}],
|
||||
activeKey: '3',
|
||||
activeKey2: ''
|
||||
activeName: '3',
|
||||
activeName2: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
|||
## 基础使用
|
||||
|
||||
<div>
|
||||
<el-tabs :active-key="activeKey">
|
||||
<el-tabs :active-name="activeName">
|
||||
<el-tab-pane label="选项卡一">选项卡一内容</el-tab-pane>
|
||||
<el-tab-pane label="选项卡二">选项卡二内容</el-tab-pane>
|
||||
<el-tab-pane label="选项卡三">选项卡三内容</el-tab-pane>
|
||||
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
|
||||
```html
|
||||
<el-tabs :active-key="activeKey">
|
||||
<el-tabs :active-name="activeName">
|
||||
<el-tab-pane label="选项卡一">选项卡一内容</el-tab-pane>
|
||||
<el-tab-pane label="选项卡二">选项卡二内容</el-tab-pane>
|
||||
<el-tab-pane label="选项卡三">选项卡三内容</el-tab-pane>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<el-tab-pane label="选项卡四">选项卡四内容</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
{{activeKey2}}
|
||||
{{activeName2}}
|
||||
|
||||
```html
|
||||
<el-tabs type="card" :closable="true">
|
||||
|
@ -113,8 +113,8 @@
|
|||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| type | 风格类型 | string | card, border-card | |
|
||||
| closable | 真实值 | boolean | true, false | false |
|
||||
| defaultActiveKey | 如果没有设置 activeKey, 则使用该值 | string | | 第一个面板 |
|
||||
| activeKey | 当前选中面板的key | string | | |
|
||||
| defaultActiveName | 如果没有设置 activeName, 则使用该值 | string | | 第一个面板 |
|
||||
| activeName | 当前选中面板的 name | string | | |
|
||||
| tab.click | tab 被点击的回调 | string | | |
|
||||
| tab.remove | tab 被删除的回调 | string | | |
|
||||
|
||||
|
@ -122,4 +122,4 @@
|
|||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||
|---------- |-------- |---------- |------------- |-------- |
|
||||
| label | 选项卡标题 | string | | |
|
||||
| key | 与选项卡activeKey对应的标识符 | string | | 该选项卡在选项卡中的index值,如第一个选项卡则为'1' |
|
||||
| name | 与选项卡 activeName 对应的标识符 | string | | 该选项卡在选项卡中的 name 值,如第一个选项卡则为'1' |
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
watch: {
|
||||
value(value) {
|
||||
this.$emit('change', value);
|
||||
this.dispatch('form-item', 'el.form.change', value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<span class="el-checkbox__input">
|
||||
<span class="el-checkbox__inner"
|
||||
:class="{
|
||||
'is-disabled': isLimit || disabled,
|
||||
'is-disabled': disabled,
|
||||
'is-checked': checked,
|
||||
'is-indeterminate': indeterminate,
|
||||
'is-focus': focus
|
||||
|
@ -18,7 +18,7 @@
|
|||
type="checkbox"
|
||||
@focus="focus = true"
|
||||
@blur="focus = false"
|
||||
:disabled="isLimit || disabled"
|
||||
:disabled="disabled"
|
||||
ref="checkbox">
|
||||
<input
|
||||
v-else
|
||||
|
@ -28,7 +28,7 @@
|
|||
@focus="focus = true"
|
||||
@blur="focus = false"
|
||||
type="checkbox"
|
||||
:disabled="isLimit || disabled">
|
||||
:disabled="disabled">
|
||||
</span>
|
||||
<span class="el-checkbox__label">
|
||||
<slot></slot>
|
||||
|
@ -38,20 +38,7 @@
|
|||
</template>
|
||||
<script>
|
||||
import Emitter from 'main/mixins/emitter';
|
||||
/**
|
||||
* checkbox
|
||||
* @module components/basic/checkbox
|
||||
* @desc 多选按钮
|
||||
* @param {string[]} value - 绑定值
|
||||
* @param {string} value - 真实值
|
||||
* @param {string} [label] - 显示值
|
||||
* @param {boolean} [disabled=false] - 是否禁用
|
||||
*
|
||||
* @example
|
||||
* <el-checkbox :value.sync="data" value="Jack"></el-checkbox>
|
||||
* <el-checkbox :value.sync="data" value="John"></el-checkbox>
|
||||
* <el-checkbox :value.sync="data" value="Mike" disabled></el-checkbox>
|
||||
*/
|
||||
|
||||
export default {
|
||||
name: 'ElCheckbox',
|
||||
|
||||
|
@ -64,12 +51,8 @@
|
|||
},
|
||||
indeterminate: Boolean,
|
||||
disabled: Boolean,
|
||||
trueLabel: {
|
||||
default: ''
|
||||
},
|
||||
falseLabel: {
|
||||
default: ''
|
||||
}
|
||||
trueLabel: [String, Number],
|
||||
falseLabel: [String, Number]
|
||||
},
|
||||
|
||||
computed: {
|
||||
|
@ -92,7 +75,7 @@
|
|||
return this._value;
|
||||
} else if (type === '[object Array]') {
|
||||
return this._value.indexOf(this.label) > -1;
|
||||
} else if (type === '[object String]') {
|
||||
} else if (type === '[object String]' || type === '[object Number]') {
|
||||
return this._value === this.trueLabel;
|
||||
}
|
||||
}
|
||||
|
@ -100,26 +83,14 @@
|
|||
|
||||
data() {
|
||||
return {
|
||||
isLimit: false,
|
||||
focus: false
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
checked(sure) {
|
||||
this.$emit('on-change', sure);
|
||||
this.dispatch('element.checkbox', sure);
|
||||
this.$emit('change', sure);
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.$on('element.checkbox.disabled', () => {
|
||||
if (this.checked) return;
|
||||
this.isLimit = true;
|
||||
});
|
||||
this.$on('element.checkbox.enabled', () => {
|
||||
this.isLimit = false;
|
||||
});
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
|
||||
if (newPage !== currentPage) {
|
||||
this.$emit('currentChange', newPage);
|
||||
this.$emit('currentchange', newPage);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -49,7 +49,7 @@ export default {
|
|||
const TEMPLATE_MAP = {
|
||||
prev: <prev></prev>,
|
||||
jumper: <jumper></jumper>,
|
||||
pager: <pager currentPage={ this.internalCurrentPage } pageCount={ this.pageCount } on-currentChange={ this.handleCurrentChange }></pager>,
|
||||
pager: <pager currentPage={ this.internalCurrentPage } pageCount={ this.pageCount } on-currentchange={ this.handleCurrentChange }></pager>,
|
||||
next: <next></next>,
|
||||
sizes: <sizes></sizes>,
|
||||
slot: <slot></slot>,
|
||||
|
@ -114,6 +114,12 @@ export default {
|
|||
},
|
||||
|
||||
Sizes: {
|
||||
created() {
|
||||
if (Array.isArray(this.$parent.pageSizes)) {
|
||||
this.$parent.internalPageSize = this.$parent.pageSizes[0];
|
||||
}
|
||||
},
|
||||
|
||||
render(h) {
|
||||
return (
|
||||
<span class="el-pagination__sizes">
|
||||
|
@ -144,7 +150,7 @@ export default {
|
|||
handleChange(val) {
|
||||
if (val !== this.$parent.internalPageSize) {
|
||||
this.$parent.internalPageSize = val = parseInt(val, 10);
|
||||
this.$parent.$emit('size-change', val);
|
||||
this.$parent.$emit('sizechange', val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +173,7 @@ export default {
|
|||
this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(target.value);
|
||||
|
||||
if (target.value !== this.oldValue && Number(target.value) === this.$parent.internalCurrentPage) {
|
||||
this.$parent.$emit('current-change', this.$parent.internalCurrentPage);
|
||||
this.$parent.$emit('currentchange', this.$parent.internalCurrentPage);
|
||||
}
|
||||
|
||||
this.oldValue = null;
|
||||
|
@ -209,7 +215,7 @@ export default {
|
|||
methods: {
|
||||
handleCurrentChange(val) {
|
||||
this.internalCurrentPage = this.getValidCurrentPage(val);
|
||||
this.$emit('current-change', this.internalCurrentPage);
|
||||
this.$emit('currentchange', this.internalCurrentPage);
|
||||
},
|
||||
|
||||
prev() {
|
||||
|
@ -218,7 +224,7 @@ export default {
|
|||
this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
||||
|
||||
if (this.internalCurrentPage !== oldPage) {
|
||||
this.$emit('current-change', this.internalCurrentPage);
|
||||
this.$emit('currentchange', this.internalCurrentPage);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -228,7 +234,7 @@ export default {
|
|||
this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
||||
|
||||
if (this.internalCurrentPage !== oldPage) {
|
||||
this.$emit('current-change', this.internalCurrentPage);
|
||||
this.$emit('currentchange', this.internalCurrentPage);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -238,7 +244,7 @@ export default {
|
|||
this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
||||
|
||||
if (this.internalCurrentPage !== oldPage) {
|
||||
this.$emit('current-change', this.internalCurrentPage);
|
||||
this.$emit('currentchange', this.internalCurrentPage);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -248,7 +254,7 @@ export default {
|
|||
this.internalCurrentPage = this.getValidCurrentPage(newVal);
|
||||
|
||||
if (this.internalCurrentPage !== oldPage) {
|
||||
this.$emit('current-change', this.internalCurrentPage);
|
||||
this.$emit('currentchange', this.internalCurrentPage);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
return this.$parent.value;
|
||||
},
|
||||
set(newValue) {
|
||||
this.$parent.value = newValue;
|
||||
this.$parent.$emit('input', newValue);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -44,7 +44,7 @@
|
|||
:disabled="disabled">
|
||||
<span class="el-radio-button__inner">
|
||||
<slot></slot>
|
||||
<template v-if="!_slotContents">{{label}}</template>
|
||||
<template v-if="!$slots.default">{{label}}</template>
|
||||
</span>
|
||||
</label>
|
||||
</template>
|
||||
|
|
|
@ -4,18 +4,17 @@
|
|||
export default {
|
||||
name: 'ElRadioGroup',
|
||||
|
||||
componentName: 'radio-group',
|
||||
|
||||
mixins: [emitter],
|
||||
|
||||
props: {
|
||||
value: {
|
||||
default: '',
|
||||
twoWay: true,
|
||||
required: true
|
||||
},
|
||||
value: [String, Number],
|
||||
size: String
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.$emit('change', value);
|
||||
this.dispatch('form-item', 'el.form.change', [this.value]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</span>
|
||||
<span class="el-radio__label">
|
||||
<slot></slot>
|
||||
<template v-if="!_slotContents">{{label}}</template>
|
||||
<template v-if="!$slots.default">{{label}}</template>
|
||||
</span>
|
||||
</label>
|
||||
</template>
|
||||
|
@ -28,9 +28,7 @@
|
|||
name: 'ElRadio',
|
||||
|
||||
props: {
|
||||
value: {
|
||||
twoWay: true
|
||||
},
|
||||
value: [String, Number],
|
||||
label: {
|
||||
type: [String, Number],
|
||||
required: true
|
||||
|
@ -43,11 +41,6 @@
|
|||
focus: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value(value) {
|
||||
this.$emit('onchange', value);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
_value: {
|
||||
get() {
|
||||
|
@ -55,9 +48,9 @@
|
|||
},
|
||||
set(newValue) {
|
||||
if (this.value !== undefined) {
|
||||
this.value = newValue;
|
||||
this.$emit('input', newValue);
|
||||
} else {
|
||||
this.$parent.value = newValue;
|
||||
this.$parent.$emit('input', newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
type: String,
|
||||
required: true
|
||||
},
|
||||
key: {
|
||||
type: String
|
||||
}
|
||||
name: String
|
||||
},
|
||||
|
||||
data() {
|
||||
|
@ -18,7 +16,8 @@
|
|||
transition: '',
|
||||
paneStyle: {
|
||||
position: 'relative'
|
||||
}
|
||||
},
|
||||
key: ''
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -28,17 +27,20 @@
|
|||
}
|
||||
},
|
||||
|
||||
events: {
|
||||
},
|
||||
|
||||
computed: {
|
||||
show() {
|
||||
return this.$parent.activeKey === this.key;
|
||||
return this.$parent.currentName === this.key;
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$parent.activeKey'(newValue, oldValue) {
|
||||
name: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
this.key = val;
|
||||
}
|
||||
},
|
||||
'$parent.currentName'(newValue, oldValue) {
|
||||
if (this.key === newValue) {
|
||||
this.transition = newValue > oldValue ? 'slideInRight' : 'slideInLeft';
|
||||
}
|
||||
|
|
|
@ -8,20 +8,23 @@
|
|||
required: true
|
||||
},
|
||||
closable: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showClose: false
|
||||
};
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="el-tabs__item"
|
||||
:class="{
|
||||
'is-active': $parent.activeKey === tab.key,
|
||||
'is-disabled': tab.disabled,
|
||||
'is-closable': closable
|
||||
}">{{tab.label}}<span class="el-icon-close" v-if="closable" @click="$emit('onremove', tab, $event)"></span></div>
|
||||
<div
|
||||
class="el-tabs__item"
|
||||
:class="{
|
||||
'is-active': $parent.currentName === tab.key,
|
||||
'is-disabled': tab.disabled,
|
||||
'is-closable': closable
|
||||
}">
|
||||
{{tab.label}}
|
||||
<span
|
||||
class="el-icon-close"
|
||||
v-if="closable"
|
||||
@click="$emit('onremove', tab, $event)">
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -11,12 +11,8 @@
|
|||
props: {
|
||||
type: String,
|
||||
tabPosition: String,
|
||||
defaultActiveKey: {
|
||||
type: String
|
||||
},
|
||||
activeKey: {
|
||||
type: String
|
||||
},
|
||||
defaultActiveName: String,
|
||||
activeName: String,
|
||||
closable: false,
|
||||
tabWidth: 0
|
||||
},
|
||||
|
@ -25,34 +21,22 @@
|
|||
return {
|
||||
tabs: [],
|
||||
children: null,
|
||||
activeTab: null
|
||||
activeTab: null,
|
||||
currentName: 0,
|
||||
barStyle: ''
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
barStyle: {
|
||||
cache: false,
|
||||
get() {
|
||||
if (this.type) return {};
|
||||
var style = {};
|
||||
var offset = 0;
|
||||
var tabWidth = 0;
|
||||
|
||||
this.tabs.every((tab, index) => {
|
||||
let $el = this.$refs.tabs[index].$el;
|
||||
if (tab.key !== this.activeKey) {
|
||||
offset += $el.clientWidth;
|
||||
return true;
|
||||
} else {
|
||||
tabWidth = $el.clientWidth;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
style.width = tabWidth + 'px';
|
||||
style.transform = `translateX(${offset}px)`;
|
||||
return style;
|
||||
watch: {
|
||||
activeName: {
|
||||
immediate: true,
|
||||
handler(val) {
|
||||
this.currentName = val || 0;
|
||||
}
|
||||
},
|
||||
|
||||
'currentName'() {
|
||||
this.calcBarStyle();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -67,27 +51,49 @@
|
|||
this.tabs.splice(index, 1);
|
||||
}
|
||||
|
||||
if (tab.key === this.activeKey) {
|
||||
if (tab.key === this.currentName) {
|
||||
let deleteIndex = this.$children.indexOf(tab);
|
||||
let nextChild = this.$children[deleteIndex + 1];
|
||||
let prevChild = this.$children[deleteIndex - 1];
|
||||
|
||||
this.activeKey = nextChild ? nextChild.key : prevChild ? prevChild.key : '-1';
|
||||
this.currentName = nextChild ? nextChild.key : prevChild ? prevChild.key : '-1';
|
||||
}
|
||||
this.$emit('tab.remove', tab);
|
||||
},
|
||||
handleTabClick(tab) {
|
||||
this.activeKey = tab.key;
|
||||
this.currentName = tab.key;
|
||||
this.$emit('tab.click', tab);
|
||||
},
|
||||
calcBarStyle() {
|
||||
if (this.type) return {};
|
||||
var style = {};
|
||||
var offset = 0;
|
||||
var tabWidth = 0;
|
||||
|
||||
this.tabs.every((tab, index) => {
|
||||
let $el = this.$refs.tabs[index].$el;
|
||||
if (tab.key !== this.currentName) {
|
||||
offset += $el.clientWidth;
|
||||
return true;
|
||||
} else {
|
||||
tabWidth = $el.clientWidth;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
style.width = tabWidth + 'px';
|
||||
style.transform = `translateX(${offset}px)`;
|
||||
|
||||
this.barStyle = style;
|
||||
}
|
||||
},
|
||||
ready() {
|
||||
if (!this.activeKey) {
|
||||
this.activeKey = this.defaultActiveKey || this.$children[0].key;
|
||||
|
||||
mounted() {
|
||||
if (!this.currentName) {
|
||||
this.currentName = this.defaultActiveName || this.$children[0].key;
|
||||
}
|
||||
this.$children.forEach(tab => {
|
||||
this.tabs.push(tab);
|
||||
});
|
||||
this.$children.forEach(tab => this.tabs.push(tab));
|
||||
this.$nextTick(() => this.calcBarStyle());
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -97,13 +103,17 @@
|
|||
<div class="el-tabs__header">
|
||||
<el-tab
|
||||
v-for="tab in tabs"
|
||||
v-ref:tabs
|
||||
ref="tabs"
|
||||
:tab="tab"
|
||||
:closable="closable"
|
||||
@onremove="removeTab"
|
||||
@click="handleTabClick(tab)"
|
||||
></el-tab>
|
||||
<div class="el-tabs__active-bar" v-bind:style="barStyle" v-if="!this.type && tabs.length > 0"></div>
|
||||
@click.native="handleTabClick(tab)">
|
||||
</el-tab>
|
||||
<div
|
||||
class="el-tabs__active-bar"
|
||||
:style="barStyle"
|
||||
v-if="!this.type && tabs.length > 0">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="el-tabs__content">
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<span class="el-tree-node__expand-icon"
|
||||
:class="{ 'is-leaf': node.isLeaf, expanded: !node.isLeaf && expanded }"
|
||||
></span>
|
||||
<el-checkbox v-if="showCheckbox" :indeterminate="node.indeterminate" v-model="node.checked" :true-label="true" :false-label="false" @on-change="handleCheckChange"></el-checkbox>
|
||||
<el-checkbox v-if="showCheckbox" :indeterminate="node.indeterminate" v-model="node.checked" :true-label="true" :false-label="false" @change="handleCheckChange"></el-checkbox>
|
||||
<!--<span class="el-tree-node__icon {{ node.icon }} {{ node.loading ? 'el-icon-loading' : '' }}" v-if="node.icon"></span>-->
|
||||
<span class="el-tree-node__label">{{ node.label }}</span>
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import Group from '../packages/group/index.js';
|
||||
import SelectDropdown from '../packages/select-dropdown/index.js';
|
||||
import Pagination from '../packages/pagination/index.js';
|
||||
import Dialog from '../packages/dialog/index.js';
|
||||
|
@ -53,7 +52,6 @@ import Message from '../packages/message/index.js';
|
|||
const install = function(Vue) {
|
||||
if (install.installed) return;
|
||||
|
||||
Vue.component(Group.name, Group);
|
||||
Vue.component(SelectDropdown.name, SelectDropdown);
|
||||
Vue.component(Pagination.name, Pagination);
|
||||
Vue.component(Dialog.name, Dialog);
|
||||
|
@ -119,7 +117,6 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|||
|
||||
module.exports = {
|
||||
install,
|
||||
Group,
|
||||
SelectDropdown,
|
||||
Pagination,
|
||||
Dialog,
|
||||
|
|
Loading…
Reference in New Issue