From effde49ba75c1b02fafa425eb17a784d96debcb0 Mon Sep 17 00:00:00 2001 From: juzi <819872918@qq.com> Date: Mon, 20 Feb 2023 15:37:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BB=84=E4=BB=B6splitPane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 4 +- package.json | 2 +- src/components/SplitPane/index.vue | 334 +++++++++++++++++++++++ src/components/SplitPane/triggerPane.vue | 45 +++ src/components/SplitPane/utils.js | 45 +++ 5 files changed, 428 insertions(+), 2 deletions(-) create mode 100644 src/components/SplitPane/index.vue create mode 100644 src/components/SplitPane/triggerPane.vue create mode 100644 src/components/SplitPane/utils.js diff --git a/index.js b/index.js index a8f6db6..ced8862 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ import Pagination from './src/components/Pagination/index.vue' import BaseTable from './src/components/BaseTable/index.vue' import InputArea from './src/components/BaseTable/subcomponents/InputArea.vue' import MethodBtn from './src/components/BaseTable/subcomponents/MethodBtn.vue' +import SplitPane from './src/components/SplitPane/index.vue' let ModuleObj = { SearchBar, @@ -11,7 +12,8 @@ let ModuleObj = { Pagination, BaseTable, InputArea, - MethodBtn + MethodBtn, + SplitPane } let MyModule = {} MyModule.install = (Vue) => { diff --git a/package.json b/package.json index cd6a9d7..a267353 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "code-brick-zj", - "version": "0.0.7", + "version": "0.1.0", "private": false, "description": "组件封装", "main": "index.js" diff --git a/src/components/SplitPane/index.vue b/src/components/SplitPane/index.vue new file mode 100644 index 0000000..95b3cc0 --- /dev/null +++ b/src/components/SplitPane/index.vue @@ -0,0 +1,334 @@ + + + + diff --git a/src/components/SplitPane/triggerPane.vue b/src/components/SplitPane/triggerPane.vue new file mode 100644 index 0000000..42c8d1a --- /dev/null +++ b/src/components/SplitPane/triggerPane.vue @@ -0,0 +1,45 @@ + + + diff --git a/src/components/SplitPane/utils.js b/src/components/SplitPane/utils.js new file mode 100644 index 0000000..febba2f --- /dev/null +++ b/src/components/SplitPane/utils.js @@ -0,0 +1,45 @@ +import Vue from 'vue' +const isServer = Vue.prototype.$isServer +// 判断参数是否是其中之一 +export function oneOf(value, validList) { + for (let i = 0; i < validList.length; i++) { + if (value === validList[i]) { + return true + } + } + return false +} + +/* istanbul ignore next */ +export const on = (function () { + if (!isServer && document.addEventListener) { + return function (element, event, handler, useCapture = false) { + if (element && event && handler) { + element.addEventListener(event, handler, useCapture) + } + } + } else { + return function (element, event, handler) { + if (element && event && handler) { + element.attachEvent('on' + event, handler) + } + } + } +})() + +/* istanbul ignore next */ +export const off = (function () { + if (!isServer && document.removeEventListener) { + return function (element, event, handler, useCapture = false) { + if (element && event) { + element.removeEventListener(event, handler, useCapture) + } + } + } else { + return function (element, event, handler) { + if (element && event) { + element.detachEvent('on' + event, handler) + } + } + } +})()