diff --git a/.babelrc b/.babelrc index 608f00b5a..ad2e61542 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,5 @@ { - "presets": ["es2015"], + "presets": ["es2015-loose"], "plugins": ["transform-vue-jsx"], "comments": false } diff --git a/examples/docs/checkbox.md b/examples/docs/checkbox.md index d5e53e9dc..619ec4213 100644 --- a/examples/docs/checkbox.md +++ b/examples/docs/checkbox.md @@ -31,32 +31,32 @@ ### 单个勾选框,逻辑值
- {{checked | json}} + {{ checked }}
```html -{{checked | json}} +{{ checked }} ``` ### 多个勾选框,绑定到同一个数组
- - - - - + + + + +
-

{{checkList | json}}

+

{{ checkList }}

```html diff --git a/packages/tree/src/transition.js b/packages/tree/src/transition.js index 3594f581e..88efb9490 100644 --- a/packages/tree/src/transition.js +++ b/packages/tree/src/transition.js @@ -1,11 +1,11 @@ -export default { +class Transition { beforeEnter(el) { el.dataset.oldPaddingTop = el.style.paddingTop; el.dataset.oldPaddingBottom = el.style.paddingBottom; el.style.height = '0'; el.style.paddingTop = 0; el.style.paddingBottom = 0; - }, + } enter(el) { el.dataset.oldOverflow = el.style.overflow; @@ -22,13 +22,13 @@ export default { } el.style.overflow = 'hidden'; - }, + } afterEnter(el) { el.style.display = ''; el.style.height = ''; el.style.overflow = el.dataset.oldOverflow; - }, + } beforeLeave(el) { el.dataset.oldPaddingTop = el.style.paddingTop; @@ -40,7 +40,7 @@ export default { el.style.height = el.scrollHeight + 'px'; } el.style.overflow = 'hidden'; - }, + } leave(el) { if (el.scrollHeight !== 0) { @@ -50,7 +50,7 @@ export default { el.style.paddingBottom = 0; }); } - }, + } afterLeave(el) { el.style.display = el.style.height = ''; @@ -59,3 +59,22 @@ export default { el.style.paddingBottom = el.dataset.oldPaddingBottom; } }; + +export default { + functional: true, + render(h, { children }) { + const data = { + props: { + appear: true + }, + on: new Transition() + }; + + children = children.map(item => { + item.data.class = ['collapse-transition']; + return item; + }); + + return h('transition', data, children); + } +}; diff --git a/packages/tree/src/tree-node.vue b/packages/tree/src/tree-node.vue index 739212c81..4041002f2 100644 --- a/packages/tree/src/tree-node.vue +++ b/packages/tree/src/tree-node.vue @@ -6,16 +6,17 @@ - + {{ node.label }} -
- -
+ +
+ +
+
@@ -33,6 +34,10 @@ } }, + components: { + CollapseTransition + }, + data() { return { $tree: null, @@ -80,10 +85,6 @@ } this.showCheckbox = tree.showCheckbox; - }, - - transitions: { - collapse: CollapseTransition } }; diff --git a/src/index.js b/src/index.js index 014a1e21d..9942a5fdb 100644 --- a/src/index.js +++ b/src/index.js @@ -100,22 +100,22 @@ const install = function(Vue) { Vue.component(Progress.name, Progress); Vue.component(Spinner.name, Spinner); - // Vue.use(Loading); + Vue.use(Loading); - // Vue.prototype.$msgbox = MessageBox; - // Vue.prototype.$alert = MessageBox.alert; - // Vue.prototype.$confirm = MessageBox.confirm; - // Vue.prototype.$prompt = MessageBox.prompt; - // Vue.prototype.$notify = Notification; + Vue.prototype.$msgbox = MessageBox; + Vue.prototype.$alert = MessageBox.alert; + Vue.prototype.$confirm = MessageBox.confirm; + Vue.prototype.$prompt = MessageBox.prompt; + Vue.prototype.$notify = Notification; }; -// auto install +auto install if (typeof window !== 'undefined' && window.Vue) { install(window.Vue); }; module.exports = { - install, + install Group, SelectDropdown, Pagination,