From 11209b0ada14d823faefafb37d2025417f6b756a Mon Sep 17 00:00:00 2001 From: "zhigang.li" Date: Fri, 21 Dec 2018 13:32:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E6=8A=BD=E5=B1=89=E7=BB=84=E4=BB=B6drag-drawer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../drag-drawer/drag-drawer-trigger.vue | 18 ++ src/components/drag-drawer/drag-drawer.vue | 156 ++++++++++++++++++ src/components/drag-drawer/index.js | 2 + src/components/drag-drawer/index.less | 70 ++++++++ src/components/drag-drawer/mixin.js | 7 + src/libs/render-dom.js | 10 ++ src/locale/lang/en-US.js | 3 +- src/locale/lang/zh-CN.js | 3 +- src/locale/lang/zh-TW.js | 3 +- src/router/routers.js | 9 + src/view/components/drag-drawer/index.vue | 97 +++++++++++ 11 files changed, 375 insertions(+), 3 deletions(-) create mode 100644 src/components/drag-drawer/drag-drawer-trigger.vue create mode 100644 src/components/drag-drawer/drag-drawer.vue create mode 100644 src/components/drag-drawer/index.js create mode 100644 src/components/drag-drawer/index.less create mode 100644 src/components/drag-drawer/mixin.js create mode 100644 src/libs/render-dom.js create mode 100644 src/view/components/drag-drawer/index.vue diff --git a/src/components/drag-drawer/drag-drawer-trigger.vue b/src/components/drag-drawer/drag-drawer-trigger.vue new file mode 100644 index 000000000..5205b07f5 --- /dev/null +++ b/src/components/drag-drawer/drag-drawer-trigger.vue @@ -0,0 +1,18 @@ + + + + + diff --git a/src/components/drag-drawer/drag-drawer.vue b/src/components/drag-drawer/drag-drawer.vue new file mode 100644 index 000000000..6611b3c96 --- /dev/null +++ b/src/components/drag-drawer/drag-drawer.vue @@ -0,0 +1,156 @@ + + + diff --git a/src/components/drag-drawer/index.js b/src/components/drag-drawer/index.js new file mode 100644 index 000000000..3d79d834a --- /dev/null +++ b/src/components/drag-drawer/index.js @@ -0,0 +1,2 @@ +import DragDrawer from './drag-drawer.vue' +export default DragDrawer diff --git a/src/components/drag-drawer/index.less b/src/components/drag-drawer/index.less new file mode 100644 index 000000000..3282b4a23 --- /dev/null +++ b/src/components/drag-drawer/index.less @@ -0,0 +1,70 @@ +@prefix: ~"drag-drawer"; +@drag-drawer-trigger-height: 100px; +@drag-drawer-trigger-width: 8px; + +.@{prefix}-wrapper{ + &.no-select{ + user-select: none; + } + &.pointer-events-none{ + pointer-events: none; + & .@{prefix}-trigger-wrapper{ + pointer-events: all; + } + } + .ivu-drawer{ + &-header{ + overflow: hidden !important; + box-sizing: border-box; + } + &-body{ + padding: 0; + overflow: visible; + position: static; + display: flex; + flex-direction: column; + } + } + .@{prefix}-body-wrapper{ + width: 100%; + height: 100%; + padding: 16px; + overflow: auto; + } + .@{prefix}-trigger-wrapper{ + top: 0; + height: 100%; + width: 0; + .@{prefix}-move-trigger{ + position: absolute; + top: 50%; + height: @drag-drawer-trigger-height; + width: @drag-drawer-trigger-width; + background: rgb(243, 243, 243); + transform: translate(-50%, -50%); + border-radius: ~"4px / 6px"; + box-shadow: 0 0 1px 1px rgba(0, 0, 0, .2); + line-height: @drag-drawer-trigger-height; + cursor: col-resize; + &-point{ + display: inline-block; + width: 50%; + transform: translateX(50%); + i{ + display: block; + border-bottom: 1px solid rgb(192, 192, 192); + padding-bottom: 2px; + } + } + } + } + .@{prefix}-footer{ + flex-grow: 1; + width: 100%; + bottom: 0; + left: 0; + border-top: 1px solid #e8e8e8; + padding: 10px 16px; + background: #fff; + } +} diff --git a/src/components/drag-drawer/mixin.js b/src/components/drag-drawer/mixin.js new file mode 100644 index 000000000..8a0172318 --- /dev/null +++ b/src/components/drag-drawer/mixin.js @@ -0,0 +1,7 @@ +export default { + data () { + return { + prefix: 'drag-drawer' + } + } +} diff --git a/src/libs/render-dom.js b/src/libs/render-dom.js new file mode 100644 index 000000000..6b4a2c036 --- /dev/null +++ b/src/libs/render-dom.js @@ -0,0 +1,10 @@ +export default { + name: 'RenderDom', + functional: true, + props: { + render: Function + }, + render: (h, ctx) => { + return ctx.props.render(h) + } +} diff --git a/src/locale/lang/en-US.js b/src/locale/lang/en-US.js index c6a0aa1cc..0a3498de4 100644 --- a/src/locale/lang/en-US.js +++ b/src/locale/lang/en-US.js @@ -39,5 +39,6 @@ export default { cropper_page: 'Cropper', message_page: 'Message Center', tree_table_page: 'Tree Table', - org_tree_page: 'Org Tree' + org_tree_page: 'Org Tree', + drag_drawer_page: 'Draggable Drawer' } diff --git a/src/locale/lang/zh-CN.js b/src/locale/lang/zh-CN.js index e6a9079bb..9626230b7 100644 --- a/src/locale/lang/zh-CN.js +++ b/src/locale/lang/zh-CN.js @@ -39,5 +39,6 @@ export default { cropper_page: '图片裁剪', message_page: '消息中心', tree_table_page: '树状表格', - org_tree_page: '组织结构树' + org_tree_page: '组织结构树', + drag_drawer_page: '可拖动抽屉' } diff --git a/src/locale/lang/zh-TW.js b/src/locale/lang/zh-TW.js index 70386743c..23bffb98c 100644 --- a/src/locale/lang/zh-TW.js +++ b/src/locale/lang/zh-TW.js @@ -39,5 +39,6 @@ export default { cropper_page: '圖片裁剪', message_page: '消息中心', tree_table_page: '樹狀表格', - org_tree_page: '組織結構樹' + org_tree_page: '組織結構樹', + drag_drawer_page: '可拖動抽屜' } diff --git a/src/router/routers.js b/src/router/routers.js index 325a74930..00ec60434 100644 --- a/src/router/routers.js +++ b/src/router/routers.js @@ -125,6 +125,15 @@ export default [ }, component: () => import('@/view/components/drag-list/drag-list.vue') }, + { + path: 'drag_drawer_page', + name: 'drag_drawer_page', + meta: { + icon: 'md-list', + title: '可拖拽抽屉' + }, + component: () => import('@/view/components/drag-drawer') + }, { path: 'org_tree_page', name: 'org_tree_page', diff --git a/src/view/components/drag-drawer/index.vue b/src/view/components/drag-drawer/index.vue new file mode 100644 index 000000000..de9008ab1 --- /dev/null +++ b/src/view/components/drag-drawer/index.vue @@ -0,0 +1,97 @@ + + + + +