zydx-plus 1.0.3 → 1.0.5

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.3",
3
+ "version": "1.0.5",
4
4
  "description": "Vue.js",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,135 @@
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>
@@ -0,0 +1,163 @@
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>
File without changes
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <div class="hello">
3
+ <div class="tip-popupWindowSearch">
4
+ <div class="tip-box">
5
+ <div>
6
+ <div class="tip-title">{{ title }}</div>
7
+ </div>
8
+ <div class="tip-boxContent">
9
+ <div class="tap-p">
10
+ <div class="tip-title2" v-if="type === 'text'" :style="{'text-align': (middle)? 'center': 'left' }" v-html="promptContent"></div>
11
+ <div class="tip-img" v-if="type === 'img'">
12
+ <img :src="url" />
13
+ </div>
14
+ </div>
15
+ </div>
16
+ <div class="tip-btnBox">
17
+ <div @click="submit">确认</div>
18
+ <div v-if="cancelShow" @click="cancel">取消</div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script>
26
+ export default {
27
+ name: 'zydx-tip-box',
28
+ props: {
29
+ type: { // 弹窗的提示标题
30
+ type: String,
31
+ default: 'text'
32
+ },
33
+ url: { // 弹窗的提示标题
34
+ type: String,
35
+ default: ''
36
+ },
37
+ title: { // 弹窗的提示标题
38
+ type: String,
39
+ default: '提示'
40
+ },
41
+ promptContent: { // 弹窗中间的文字内容
42
+ type: String,
43
+ default: '默认文字'
44
+ },
45
+ middle: { // 弹窗中间的文字内容是居中 还是居左 默认居中
46
+ type: Boolean,
47
+ default: true
48
+ },
49
+ cancelShow: {
50
+ type: Boolean,
51
+ default: true
52
+ }
53
+ },
54
+ data () {
55
+ return {}
56
+ },
57
+ methods: {
58
+ submit: function (val) {
59
+ this.$emit('rheResults', val)
60
+ },
61
+ cancel: function () {
62
+ this.$emit('cancel')
63
+ }
64
+ }
65
+ }
66
+ </script>
67
+
68
+ <style scoped src="./zydxStyle.css"></style>
@@ -0,0 +1,87 @@
1
+ .tip-popupWindowSearch{
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ right: 0;
6
+ bottom: 0;
7
+ background-color: rgba(0, 0, 0, 0.2);
8
+ z-index: 200;
9
+ display: flex;
10
+ align-items: center;
11
+ }
12
+ .tip-box {
13
+ width: 480px;
14
+ padding: 40px 40px;
15
+ background-color: white;
16
+ border-radius: 5px;
17
+ border: 5px rgba(0, 0, 0, .1) solid;
18
+ margin: 0 auto;
19
+ }
20
+ .tip-boxContent{
21
+ max-height: 600px;
22
+ }
23
+ .tip-boxContent:hover{
24
+ cursor:default
25
+ }
26
+
27
+ .tip-closeBtn {
28
+ position: absolute;
29
+ top: 10px;
30
+ right: 10px;
31
+ font-size: 28px;
32
+ color: #767676;
33
+ }
34
+ .tip-title {
35
+ margin-bottom: 20px;
36
+ font-size: 18px;
37
+ font-weight: 700;
38
+ flex-shrink: 0;
39
+ display: flex;
40
+ align-items: flex-end;
41
+ justify-content: center;
42
+ flex-wrap: wrap;
43
+ overflow: hidden;
44
+ }
45
+ .tip-title1 {
46
+ font-size: 16px;
47
+ text-align: left;
48
+ }
49
+ .tip-title2{
50
+ font-size: 16px;
51
+ text-align: center;
52
+ line-height: 30px;
53
+ }
54
+
55
+ .tip-btnBox {
56
+ margin-top: 20px;
57
+ flex-shrink: 0;
58
+ display: flex;
59
+ justify-content: center;
60
+ align-items: flex-start;
61
+ font-size: 12px;
62
+ }
63
+
64
+ .tip-btnBox>div {
65
+ width: 60px;
66
+ height: 22px;
67
+ line-height: 22px;
68
+ margin-right: 10px;
69
+ border-radius: 3px;
70
+ border: 1px solid #000000;
71
+ cursor: pointer;
72
+ text-align: center;
73
+ }
74
+ .tip-quesTitle{
75
+ padding-left: 2px;
76
+ margin-left: -10px!important;
77
+ }
78
+ .tap-p{
79
+ text-align: center;
80
+ }
81
+ .tip-img{
82
+ width: 70%;
83
+ display: inline-block;
84
+ }
85
+ .tip-img>img{
86
+ width: 100%;
87
+ }
package/src/index.js CHANGED
@@ -1,7 +1,9 @@
1
- import Input from './components/input/index';
1
+ import tipBox from './components/tipBox/index';
2
+ import menuTree from './components/menuTree/index';
2
3
 
3
4
  const components = [
4
- Input
5
+ tipBox,
6
+ menuTree
5
7
  ];
6
8
 
7
9
  const install = function(Vue, opts = {}) {
@@ -15,7 +17,8 @@ if (typeof window !== 'undefined' && window.Vue) {
15
17
  }
16
18
 
17
19
  export default {
18
- version: '1.0.2',
20
+ version: '1.0.5',
19
21
  install,
20
- Input
22
+ tipBox,
23
+ menuTree
21
24
  };
@@ -1,16 +0,0 @@
1
- <template>
2
- <div class="hello">
3
- <h1>111111</h1>
4
- </div>
5
- </template>
6
-
7
- <script>
8
- export default {
9
- name: 'zydxInput'
10
- }
11
- </script>
12
-
13
- <!-- Add "scoped" attribute to limit CSS to this component only -->
14
- <style scoped>
15
-
16
- </style>