From de23e4de11de5a11dd0da5e9a9b14f1433344875 Mon Sep 17 00:00:00 2001
From: tjz <415800467@qq.com>
Date: Fri, 2 Mar 2018 22:12:52 +0800
Subject: [PATCH] add vc-cascader
---
components/_util/vnode.js | 15 +-
components/vc-cascader/Cascader.vue | 484 +++++++++++-----------
components/vc-cascader/Menus.vue | 256 ++++++------
components/vc-cascader/demo/animation.vue | 64 +++
examples/routes.js | 2 +-
package-lock.json | 15 +
package.json | 2 +
7 files changed, 462 insertions(+), 376 deletions(-)
create mode 100644 components/vc-cascader/demo/animation.vue
diff --git a/components/_util/vnode.js b/components/_util/vnode.js
index 20d859baf..b61daa0fa 100644
--- a/components/_util/vnode.js
+++ b/components/_util/vnode.js
@@ -62,13 +62,18 @@ export function cloneElement (n, nodeProps, deep) {
const node = cloneVNode(ele, deep)
const { props = {}, key, on = {}, children } = nodeProps
const data = node.data || {}
- const { style = data.style,
- class: cls = data.class,
- attrs = data.attrs,
+ const { style = {},
+ class: cls = {},
+ attrs = {},
ref,
- domProps = data.domProps,
+ domProps = {},
} = nodeProps
- node.data = Object.assign({}, data, { style, attrs, class: cls, domProps })
+ node.data = Object.assign({}, data, {
+ style: { ...data.style, ...style },
+ attrs: { ...data.attrs, ...attrs },
+ class: { ...data.class, ...cls },
+ domProps: { ...data.domProps, ...domProps },
+ })
if (node.componentOptions) {
node.componentOptions.propsData = node.componentOptions.propsData || {}
node.componentOptions.listeners = node.componentOptions.listeners || {}
diff --git a/components/vc-cascader/Cascader.vue b/components/vc-cascader/Cascader.vue
index 92194ef90..a2900c722 100644
--- a/components/vc-cascader/Cascader.vue
+++ b/components/vc-cascader/Cascader.vue
@@ -1,11 +1,13 @@
diff --git a/components/vc-cascader/Menus.vue b/components/vc-cascader/Menus.vue
index 53b6e200d..55662b0be 100644
--- a/components/vc-cascader/Menus.vue
+++ b/components/vc-cascader/Menus.vue
@@ -1,156 +1,150 @@
diff --git a/components/vc-cascader/demo/animation.vue b/components/vc-cascader/demo/animation.vue
new file mode 100644
index 000000000..ed1da4bdb
--- /dev/null
+++ b/components/vc-cascader/demo/animation.vue
@@ -0,0 +1,64 @@
+
diff --git a/examples/routes.js b/examples/routes.js
index 1e76bdeae..68d799d79 100644
--- a/examples/routes.js
+++ b/examples/routes.js
@@ -3,7 +3,7 @@ const AsyncComp = () => {
const hashs = window.location.hash.split('/')
const d = hashs[hashs.length - 1]
return {
- component: import(`../components/affix/demo/${d}`),
+ component: import(`../components/vc-cascader/demo/${d}`),
}
}
export default [
diff --git a/package-lock.json b/package-lock.json
index 3071a2d24..ffc3db6a2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -416,6 +416,11 @@
"integrity": "sha1-3Tz7gO15c6dRF82sabC5nshhhvU=",
"dev": true
},
+ "array-tree-filter": {
+ "version": "2.1.0",
+ "resolved": "http://registry.npm.taobao.org/array-tree-filter/download/array-tree-filter-2.1.0.tgz",
+ "integrity": "sha1-hzrAD+yDdJ8lWsjdCDgUtPYykZA="
+ },
"array-union": {
"version": "1.0.2",
"resolved": "http://10.134.27.134:7001/array-union/download/array-union-1.0.2.tgz",
@@ -10935,6 +10940,16 @@
"safe-buffer": "5.1.1"
}
},
+ "shallow-equal": {
+ "version": "1.0.0",
+ "resolved": "http://registry.npm.taobao.org/shallow-equal/download/shallow-equal-1.0.0.tgz",
+ "integrity": "sha1-UI0YOLPeWQq4dXsBGyXkMJAJRfc="
+ },
+ "shallowequal": {
+ "version": "1.0.2",
+ "resolved": "http://registry.npm.taobao.org/shallowequal/download/shallowequal-1.0.2.tgz",
+ "integrity": "sha1-FWHb3vuMAUCBADGQhXZNo/z4P48="
+ },
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/shebang-command/download/shebang-command-1.2.0.tgz",
diff --git a/package.json b/package.json
index b0a193a8e..979d69bd8 100644
--- a/package.json
+++ b/package.json
@@ -88,6 +88,7 @@
},
"dependencies": {
"add-dom-event-listener": "^1.0.2",
+ "array-tree-filter": "^2.1.0",
"classnames": "^2.2.5",
"component-classes": "^1.2.6",
"css-animation": "^1.4.1",
@@ -100,6 +101,7 @@
"lodash.isplainobject": "^4.0.6",
"moment": "^2.20.1",
"omit.js": "^1.0.0",
+ "shallow-equal": "^1.0.0",
"shallowequal": "^1.0.2",
"vue": "^2.5.13",
"vue-clipboard2": "0.0.8",