From ac3f87841c4e68884365e620717bf973779f9de8 Mon Sep 17 00:00:00 2001 From: lanchenghao Date: Mon, 21 Feb 2022 11:07:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81vue3.x?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .browserslistrc | 2 + .eslintrc.js | 23 +- README.md | 56 +- babel.config.js | 6 +- package.json | 47 +- src/App.vue | 14 +- src/components/Attributes.vue | 10 - src/components/Base06.vue | 10 +- src/components/Base07.vue | 10 - src/components/BaseCard.vue | 4 +- src/components/CustomRenderContentCard.vue | 28 + ...{VueOkrTreeDeom.vue => VueOkrTreeDemo.vue} | 64 +- src/lib/vue-okr-tree/OkrTree.vue | 7 - src/lib/vue-okr-tree/OkrTreeNode.vue | 190 +- src/lib/vue-okr-tree/model/event-bus.js | 5 + src/main.js | 11 +- vue.config.js | 7 +- yarn.lock | 9473 ++++++++--------- 18 files changed, 4423 insertions(+), 5544 deletions(-) create mode 100644 src/components/CustomRenderContentCard.vue rename src/components/{VueOkrTreeDeom.vue => VueOkrTreeDemo.vue} (76%) create mode 100644 src/lib/vue-okr-tree/model/event-bus.js diff --git a/.browserslistrc b/.browserslistrc index d6471a3..dc3bc09 100644 --- a/.browserslistrc +++ b/.browserslistrc @@ -1,2 +1,4 @@ > 1% last 2 versions +not dead +not ie 11 diff --git a/.eslintrc.js b/.eslintrc.js index 3f3df4f..34148e6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,12 +3,21 @@ module.exports = { env: { node: true }, - extends: ["plugin:vue/essential", "@vue/prettier"], - rules: { - "no-console": process.env.NODE_ENV === "production" ? "error" : "off", - "no-debugger": process.env.NODE_ENV === "production" ? "error" : "off" - }, + 'extends': [ + 'plugin:vue/vue3-essential', + 'eslint:recommended' + ], parserOptions: { - parser: "babel-eslint" + parser: '@babel/eslint-parser' + }, + rules: { + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + "vue/multi-word-component-names": "off", + "no-useless-escape": "off", + "no-unused-vars": "off", + "vue/no-mutating-props": "off", + "no-prototype-builtins": "off", + "vue/no-unused-components": "warn" } -}; +} diff --git a/README.md b/README.md index c991bbd..a6a472c 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,16 @@ -## 更新日志 - - - * 更新时间 2020/12/02 - * 修复异步修改data不渲染问题 对应版本:vue-okr-tree@1.0.5 - * 更新时间 2020/12/05 - * 修改部分展示 bug 对应版本:vue-okr-tree@1.0.6 - * 更新时间 2021/01/13 - * 增加 updateKeyChildren 方法:vue-okr-tree@1.0.7 - * 更新时间 2021/02/03 - * 增加 node-btn-content 属性,对展开圆圈内容自定义处理 vue-okr-tree@1.0.8 - * 更新时间 2021/02/04 - * 增加 showNodeNum 属性显示子节点数 vue-okr-tree@1.0.9 - * 更新时间 2021/09/07 - * 修复节点倒叙显示问题 对应版本:vue-okr-tree@1.0.10 +## 使用前阅读 -## 文档和事例 - -地址:http://www.longstudy.club/vue-okr-tree-doc/index.html +* 该库fork自qq449245884/vue-okr-tree vue2.x版本 +* 因不想在提PR上浪费时间,所以直接fork修改并发布vue3.x版本 +## 更新日志 + * 更新时间 2022/02/21 + * 修复```render-content```和```nodeBtnContent```在vue3.x使用问题 + ## vue-okr-tree -基于 Vue 2的组织架构树组件 +基于 Vue 3的组织架构树组件 ## Install @@ -36,22 +25,11 @@ yarn add vue-okr-tree ``` js -import {VueOkrTree} from 'vue-okr-tree'; -import 'vue-okr-tree/dist/vue-okr-tree.css' +import {VueOkrTree} from 'vue-okr-tree-vue3'; +import 'vue-okr-tree-vue3/dist/vue-okr-tree.css' // ... ``` - -### CDN - -``` html -# css - - -# js - -``` - ## API #### Attributes @@ -111,19 +89,5 @@ append | 为 Tree 中的一个节点追加一个子节点 | (data, parentNo insertBefore | 为 Tree 的一个节点的前面增加一个节点 | (data, refNode) 接收两个参数,1. 要增加的节点的 data 2. 要增加的节点的后一个节点的 data、key 或者 node insertAfter | 为 Tree 的一个节点的后面增加一个节点 | (data, refNode) 接收两个参数,1. 要增加的节点的 data 2. 要增加的节点的前一个节点的 data、key 或者 node - - - -## 浏览器支持情况 - -Modern browsers and Internet Explorer 10+. - ## License [MIT](http://opensource.org/licenses/MIT) - - - -## 作品展示 - - -![](./src/assets/pro1.png) diff --git a/babel.config.js b/babel.config.js index 3ecebf1..e955840 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,5 @@ module.exports = { - presets: ["@vue/app"] -}; + presets: [ + '@vue/cli-plugin-babel/preset' + ] +} diff --git a/package.json b/package.json index 35e024b..1e0cf00 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "vue-okr-tree", - "version": "1.0.10", + "name": "vue-okr-tree-vue3", + "version": "1.0.1", "main": "dist/vue-okr-tree.umd.min.js", "scripts": { "dev": "vue-cli-service serve --open", @@ -11,36 +11,45 @@ "lint": "vue-cli-service lint" }, "dependencies": { - "core-js": "^2.6.5", + "core-js": "^3.8.3", + "events": "^3.3.0", "github-markdown-css": "^4.0.0", "prismjs": "^1.22.0", - "vue": "^2.6.10" + "vue": "^3.2.13" }, "devDependencies": { - "@vue/cli-plugin-babel": "^3.0.5", - "@vue/cli-plugin-eslint": "^3.0.5", - "@vue/cli-service": "^3.0.5", + "@babel/core": "^7.17.5", + "@babel/eslint-parser": "^7.17.0", + "@vue/cli-plugin-babel": "~5.0.0", + "@vue/cli-plugin-eslint": "~5.0.0", + "@vue/cli-service": "~5.0.0", "@vue/eslint-config-prettier": "^5.0.0", "babel-eslint": "^10.0.1", - "eslint": "^5.16.0", - "eslint-plugin-prettier": "^3.1.0", - "eslint-plugin-vue": "^5.0.0", - "prettier": "^1.18.2", - "vue-template-compiler": "^2.6.10" + "eslint": "^7.32.0", + "eslint-plugin-vue": "^8.0.3" }, - "description": "一个特殊布局模式结构的`vue Tree`组件", - "keywords": ["vue-chart", "vue-tree", "org-tree", "chart", "tree", "org","okr","vue-ork-tree"], + "description": "基于qq449245884/vue-okr-tree改为vue3版本", + "keywords": [ + "vue-chart", + "vue-tree", + "org-tree", + "chart", + "tree", + "org", + "okr", + "vue-ork-tree" + ], "license": "MIT", "author": { - "name": "前端小智", - "email": "449245884@qq.com", - "url": "https://github.com/qq449245884" + "name": "Kevin老师", + "email": "lanlazy@163.com", + "url": "https://github.com/lazyhero" }, "repository": { "type": "git", - "url": "https://github.com/qq449245884/vue-okr-tree" + "url": "https://github.com/lazyhero/vue-okr-tree" }, "bugs": { - "url": "https://github.com/qq449245884/vue-okr-tree/issues" + "url": "https://github.com/lazyhero/vue-okr-tree/issues" } } diff --git a/src/App.vue b/src/App.vue index 71ad348..119e4db 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,18 +1,16 @@ - - - diff --git a/src/components/Attributes.vue b/src/components/Attributes.vue index 2c45d93..20f2717 100644 --- a/src/components/Attributes.vue +++ b/src/components/Attributes.vue @@ -170,13 +170,3 @@ - - - - diff --git a/src/components/Base06.vue b/src/components/Base06.vue index 49de5eb..f46d3a8 100644 --- a/src/components/Base06.vue +++ b/src/components/Base06.vue @@ -1,6 +1,6 @@