zydx-plus 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zydx-plus",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -20,7 +20,7 @@
20
20
  "license": "MIT",
21
21
  "author": "",
22
22
  "peerDependencies": {
23
- "vue": "^2.5.17"
23
+ "vue": "^3.2.13"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@vue/component-compiler-utils": "^2.6.0",
package/src/index.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import tipBox from './components/tipBox/index';
2
- import menuTree from './components/menuTree/index';
3
2
 
4
3
  const components = [
5
- tipBox,
6
- menuTree
4
+ tipBox
7
5
  ];
8
6
 
9
7
  const install = function(Vue, opts = {}) {
@@ -17,8 +15,7 @@ if (typeof window !== 'undefined' && window.Vue) {
17
15
  }
18
16
 
19
17
  export default {
20
- version: '1.0.5',
18
+ version: '1.0.6',
21
19
  install,
22
- tipBox,
23
- menuTree
20
+ tipBox
24
21
  };
@@ -1,7 +0,0 @@
1
- import menuTree from './src/ZydxMenuTree.vue';
2
-
3
- menuTree.install = function(Vue) {
4
- Vue.component(menuTree.name, menuTree);
5
- };
6
-
7
- export default menuTree;
@@ -1,135 +0,0 @@
1
- <template>
2
- <div class="menuTree">
3
- <slot></slot>
4
- <div v-for="(item, index) in targetTree" :key="index">
5
- <zydx-menu-tree-info
6
- :nodeSet="nodeSet"
7
- :isShowLine="isShowLine"
8
- :isShowUpDown="isShowUpDown"
9
- :menu-info="item"
10
- :selectItem="selectItem"
11
- @clickItem="clickItem"
12
- ></zydx-menu-tree-info>
13
- </div>
14
- </div>
15
- </template>
16
-
17
- <script>
18
- import zydxMenuTreeInfo from "./ZydxMenuTreeInfo";
19
- export default {
20
- name: "zydx-menu-tree",
21
- components: {
22
- zydxMenuTreeInfo,
23
- },
24
- props: {
25
- // 是否显示展开收起动作
26
- isShowUpDown: {
27
- type: Boolean,
28
- default: false,
29
- },
30
- // 是否显示底线
31
- isShowLine: {
32
- type: Boolean,
33
- default: false,
34
- },
35
- // 节点设置
36
- nodeSet: {
37
- type: Number,
38
- default: 2,
39
- },
40
- // 选择当前的节点
41
- selectItem: {
42
- type: Object,
43
- default: function () {
44
- return {};
45
- },
46
- },
47
- // 树数据
48
- treeData: {
49
- type: Array,
50
- required: true,
51
- },
52
- },
53
- computed: {
54
- targetTree: function () {
55
- let that = this;
56
- let targetTree = [];
57
- let minLevel = "";
58
- that.treeData.map(function (item) {
59
- if (that.isShowUpDown) {
60
- // 如果设置收起展开, 添加控制变量
61
- that.$set(item, "isShowUpDown", false);
62
- } else {
63
- that.$set(item, "isShowUpDown", true);
64
- }
65
- if (minLevel === "") {
66
- minLevel = item.level;
67
- } else {
68
- if (item.level < minLevel) {
69
- minLevel = item.level;
70
- }
71
- }
72
- });
73
- this.treeData.map(function (item) {
74
- if (item.level === minLevel) {
75
- targetTree.push(item);
76
- }
77
- });
78
- targetTree.map(function (item) {
79
- that.forArr(that.treeData, item);
80
- });
81
- if (that.isShowUpDown) {
82
- for (let i = 0; i < targetTree.length; i++) {
83
- this.setIsShowUpDown(targetTree[i], i);
84
- }
85
- }
86
- return targetTree;
87
- },
88
- },
89
- methods: {
90
- // 原始目录树转换方法
91
- forArr: function (arr, obj) {
92
- let that = this;
93
- let newArr = [];
94
- arr.map(function (item) {
95
- if (item.pcatalogId === obj.catalogId) {
96
- newArr.push(item);
97
- }
98
- });
99
- if (newArr.length === 0) {
100
- return false;
101
- }
102
- obj.children = newArr;
103
- newArr.map(function (item) {
104
- that.forArr(arr, item);
105
- });
106
- },
107
- // 点击回调事件
108
- clickItem(item) {
109
- this.$emit("clickItem", item);
110
- },
111
- // 递归调用修改状态
112
- setIsShowUpDown(item, index) {
113
- if (index === 0) {
114
- let children = item.children;
115
- if (children && children.length !== 0) {
116
- this.$set(item, "isShowUpDown", true);
117
- for (let i = 0; i < children.length; i++) {
118
- this.setIsShowUpDown(children[i], i);
119
- }
120
- }
121
- }
122
- },
123
- },
124
- };
125
- </script>
126
-
127
- <style scoped>
128
- .menuTree {
129
- overflow: hidden;
130
- white-space: nowrap;
131
- text-overflow: ellipsis;
132
- padding: 0px 10px;
133
- }
134
-
135
- </style>
@@ -1,163 +0,0 @@
1
- /**
2
- * @开发者: zmy
3
- * @描述: 目录树通用组件
4
- * @创建时间: 2022-08-16 11:00:00
5
- * @内容:
6
- 必传值:名字/类型/默认值/作用
7
- menuInfo 目录树数据
8
- 非必传值:
9
- nodeSet 传入当前的节点设置, 小于当前节点设置不可点,灰色
10
- selectItem 传入当前选择的节点,是一个对象
11
- * @回调事件:
12
- * clickItem 点击点前节点的回调, 返回点击的节点
13
- @组件内方法:
14
- */
15
- <template>
16
- <div>
17
- <div
18
- class="lineHeight30"
19
- :class="menuInfo.level === 0 ? '' : 'marginLeft14'"
20
- >
21
- <div
22
- style="display: flex; flex-direction: row"
23
- :style="this.isShowLine ? 'border-bottom: 1px #CCCCCC dashed;' : ''"
24
- >
25
- <div
26
- class="widthB100 ellipse cursor"
27
- :class="menuTitleStyle"
28
- @click.stop="clickItem(menuInfo)"
29
- >
30
- {{ menuInfo.title }}
31
- </div>
32
- <div v-show="isShowUpDown && menuInfo.children">
33
- <span
34
- class="iconfont"
35
- v-html="defaultFont"
36
- @click="clickFont(menuInfo)"
37
- ></span>
38
- </div>
39
- </div>
40
- <div v-show="menuInfo.isShowUpDown">
41
- <div v-for="(item, index) in menuInfo.children" :key="index">
42
- <zydx-menu-tree-info
43
- :isShowUpDown="isShowUpDown"
44
- :isShowLine="isShowLine"
45
- :selectItem="selectItem"
46
- :menu-info="item"
47
- :nodeSet="nodeSet"
48
- @clickItem="clickItem"
49
- >
50
- </zydx-menu-tree-info>
51
- </div>
52
- </div>
53
- </div>
54
- </div>
55
- </template>
56
-
57
- <script>
58
- import zydxMenuTreeInfo from "./ZydxMenuTreeInfo";
59
- export default {
60
- name: "zydx-menu-tree-info",
61
- components: {
62
- zydxMenuTreeInfo,
63
- },
64
- props: {
65
- // 是否显示展开收起动作
66
- isShowUpDown: {
67
- type: Boolean,
68
- default: false,
69
- },
70
- // 是否显示底线
71
- isShowLine: {
72
- type: Boolean,
73
- default: false,
74
- },
75
- // 节点等级设置
76
- nodeSet: {
77
- type: Number,
78
- required: true,
79
- },
80
- // 选择当前的节点
81
- selectItem: {
82
- type: Object,
83
- default: function () {
84
- return {};
85
- },
86
- },
87
- // 树数据
88
- menuInfo: {
89
- type: Object,
90
- required: true,
91
- },
92
- },
93
- computed: {
94
- defaultFont() {
95
- if (this.menuInfo.isShowUpDown) {
96
- return "&#xeaf5;";
97
- }
98
- return "&#xeaf3;";
99
- },
100
- menuTitleStyle() {
101
- let ar = [];
102
- console.log(this.nodeSet);
103
- if (parseInt(this.menuInfo.level) > parseInt(this.nodeSet)) {
104
- ar.push("disable");
105
- }
106
- if (this.selectItem === this.menuInfo) {
107
- ar.push("active");
108
- }
109
- return ar;
110
- },
111
- },
112
- methods: {
113
- clickItem(item) {
114
- this.$emit("clickItem", item);
115
- },
116
- clickFont(item) {
117
- item.isShowUpDown = !item.isShowUpDown;
118
- // if (item.isShowUpDown) {
119
- // this.defaultFont = '&#xeaf5;'
120
- // } else {
121
- // this.defaultFont = '&#xeaf3;'
122
- // }
123
- },
124
- },
125
- };
126
- </script>
127
-
128
- <style scoped>
129
- @font-face {
130
- font-family: "iconfont";
131
- src: url("iconfont.ttf?t=1660878683989") format("truetype");
132
- }
133
- .iconfont {
134
- font-family: "iconfont" !important;
135
- font-size: 16px;
136
- font-style: normal;
137
- -webkit-font-smoothing: antialiased;
138
- -moz-osx-font-smoothing: grayscale;
139
- cursor: pointer;
140
- }
141
- .cursor {
142
- cursor: pointer;
143
- }
144
- .disable {
145
- color: #7c7c7c;
146
- pointer-events: none;
147
- cursor: default;
148
- }
149
- .border_bottom {
150
- border-bottom: 1px #cccccc dashed;
151
- }
152
- .active {
153
- color: #00ff00;
154
- }
155
- .ellipse {
156
- text-overflow: ellipsis;
157
- white-space: nowrap;
158
- overflow: hidden;
159
- }
160
- .marginLeft14 {
161
- margin-left: 14px;
162
- }
163
- </style>