Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
609901ae
Commit
609901ae
authored
Aug 15, 2016
by
Leopoldthecoder
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'next' of github.com:eleme/element-ui into next
# Conflicts: # bin/build-entry.js # src/index.js
parents
557a09c6
cb68b3d4
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
186 additions
and
183 deletions
+186
-183
components.json
components.json
+0
-3
examples/docs/checkbox.md
examples/docs/checkbox.md
+29
-14
examples/docs/pagination.md
examples/docs/pagination.md
+8
-4
examples/docs/radio.md
examples/docs/radio.md
+23
-22
examples/docs/select.md
examples/docs/select.md
+5
-1
examples/docs/tabs.md
examples/docs/tabs.md
+8
-8
packages/checkbox/src/checkbox-group.vue
packages/checkbox/src/checkbox-group.vue
+1
-0
packages/checkbox/src/checkbox.vue
packages/checkbox/src/checkbox.vue
+8
-37
packages/pagination/src/pager.vue
packages/pagination/src/pager.vue
+1
-1
packages/pagination/src/pagination.js
packages/pagination/src/pagination.js
+14
-8
packages/radio/src/radio-button.vue
packages/radio/src/radio-button.vue
+2
-2
packages/radio/src/radio-group.vue
packages/radio/src/radio-group.vue
+4
-5
packages/radio/src/radio.vue
packages/radio/src/radio.vue
+4
-11
packages/tabs/src/tab-pane.vue
packages/tabs/src/tab-pane.vue
+11
-9
packages/tabs/src/tab.vue
packages/tabs/src/tab.vue
+14
-11
packages/tabs/src/tabs.vue
packages/tabs/src/tabs.vue
+53
-43
packages/tree/src/tree-node.vue
packages/tree/src/tree-node.vue
+1
-1
src/index.js
src/index.js
+0
-3
No files found.
components.json
View file @
609901ae
{
"group"
:
[
"./packages/group/index.js"
],
"select-dropdown"
:
[
"./packages/select-dropdown/index.js"
],
...
...
examples/docs/checkbox.md
View file @
609901ae
...
...
@@ -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) |
examples/docs/pagination.md
View file @
609901ae
...
...
@@ -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`
|
examples/docs/radio.md
View file @
609901ae
...
...
@@ -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 |
examples/docs/select.md
View file @
609901ae
...
...
@@ -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
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
...
...
examples/docs/tabs.md
View file @
609901ae
...
...
@@ -15,8 +15,8 @@
title: '选项卡四',
content: '选项卡四内容'
}],
active
Key
: '3',
active
Key
2: ''
active
Name
: '3',
active
Name
2: ''
}
}
}
...
...
@@ -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>
{{active
Key
2}}
{{active
Name
2}}
```
html
<el-tabs
type=
"card"
:closable=
"true"
>
...
...
@@ -113,8 +113,8 @@
|---------- |-------- |---------- |------------- |-------- |
| type | 风格类型 | string | card, border-card | |
| closable | 真实值 | boolean | true, false | false |
| defaultActive
Key | 如果没有设置 activeKey
, 则使用该值 | string | | 第一个面板 |
| active
Key | 当前选中面板的key
| string | | |
| defaultActive
Name | 如果没有设置 activeName
, 则使用该值 | string | | 第一个面板 |
| active
Name | 当前选中面板的 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' |
packages/checkbox/src/checkbox-group.vue
View file @
609901ae
...
...
@@ -15,6 +15,7 @@
watch
:
{
value
(
value
)
{
this
.
$emit
(
'
change
'
,
value
);
this
.
dispatch
(
'
form-item
'
,
'
el.form.change
'
,
value
);
}
}
...
...
packages/checkbox/src/checkbox.vue
View file @
609901ae
...
...
@@ -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
>
packages/pagination/src/pager.vue
View file @
609901ae
...
...
@@ -71,7 +71,7 @@
}
if
(
newPage
!==
currentPage
)
{
this
.
$emit
(
'
current
C
hange
'
,
newPage
);
this
.
$emit
(
'
current
c
hange
'
,
newPage
);
}
}
},
...
...
packages/pagination/src/pagination.js
View file @
609901ae
...
...
@@ -49,7 +49,7 @@ export default {
const
TEMPLATE_MAP
=
{
prev
:
<
prev
><
/prev>
,
jumper
:
<
jumper
><
/jumper>
,
pager
:
<
pager
currentPage
=
{
this
.
internalCurrentPage
}
pageCount
=
{
this
.
pageCount
}
on
-
current
C
hange
=
{
this
.
handleCurrentChange
}
><
/pager>
,
pager
:
<
pager
currentPage
=
{
this
.
internalCurrentPage
}
pageCount
=
{
this
.
pageCount
}
on
-
current
c
hange
=
{
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
);
}
},
...
...
packages/radio/src/radio-button.vue
View file @
609901ae
...
...
@@ -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>
packages/radio/src/radio-group.vue
View file @
609901ae
...
...
@@ -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
]);
}
}
...
...
packages/radio/src/radio.vue
View file @
609901ae
...
...
@@ -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
)
;
}
}
}
...
...
packages/tabs/src/tab-pane.vue
View file @
609901ae
...
...
@@ -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
'
;
}
...
...
packages/tabs/src/tab.vue
View file @
609901ae
...
...
@@ -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
>
packages/tabs/src/tabs.vue
View file @
609901ae
...
...
@@ -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"
>
...
...
packages/tree/src/tree-node.vue
View file @
609901ae
...
...
@@ -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>
...
...
src/index.js
View file @
609901ae
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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment