tianheng-ui 0.1.72 → 0.1.73

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,7 +1,7 @@
1
1
  {
2
2
  "name": "tianheng-ui",
3
3
  "description": "A Vue.js project",
4
- "version": "0.1.72",
4
+ "version": "0.1.73",
5
5
  "author": "shu lang <403732931@qq.com>",
6
6
  "license": "MIT",
7
7
  "private": false,
@@ -14,41 +14,43 @@
14
14
  @clear="handleInputClear"
15
15
  >
16
16
  <div v-if="icon" class="input-prefix" slot="prefix">
17
- <i :class="icon" class="icon" />
17
+ <i
18
+ v-if="icon.indexOf('th-icon') > -1 || icon.indexOf('el-icon') > -1"
19
+ :class="`icon ${icon}`"
20
+ />
21
+ <a-icon v-else class="icon" :type="icon" />
18
22
  </div>
19
23
  </el-input>
20
24
 
21
- <el-tabs v-model="tabsActiveName" type="border-card">
25
+ <el-tabs v-model="activeName" type="border-card">
22
26
  <el-tab-pane label="Tianheng图标库" name="tianheng"> </el-tab-pane>
23
27
  <el-tab-pane v-if="element" label="Element图标库" name="element">
24
28
  </el-tab-pane>
25
29
  <el-tab-pane v-if="antDesign" label="AntDesign图标库" name="antDesign">
26
30
  </el-tab-pane>
27
- <div v-if="tabsActiveName === 'tianheng'" class="th-icons-content">
31
+ <div v-if="activeName === 'tianheng'" class="th-icons-content">
28
32
  <i
29
- v-for="(icon, index) in tianhengIcons"
30
- class="icon"
31
- :class="icon"
33
+ v-for="(item, index) in tianhengIcons"
34
+ :class="`icon ${item}`"
32
35
  :key="index"
33
- @click="handleIconClick(icon)"
36
+ @click="handleIconClick(item)"
34
37
  />
35
38
  </div>
36
- <div v-if="tabsActiveName === 'element'" class="th-icons-content">
39
+ <div v-if="activeName === 'element'" class="th-icons-content">
37
40
  <i
38
- v-for="(icon, index) in elementIcons"
39
- class="icon"
40
- :class="icon"
41
+ v-for="(item, index) in elementIcons"
42
+ :class="`icon ${item}`"
41
43
  :key="index"
42
- @click="handleIconClick(icon)"
44
+ @click="handleIconClick(item)"
43
45
  />
44
46
  </div>
45
- <div v-if="tabsActiveName === 'antDesign'" class="th-icons-content">
47
+ <div v-if="activeName === 'antDesign'" class="th-icons-content">
46
48
  <a-icon
47
- v-for="(icon, index) in antDesignIcons"
49
+ v-for="(item, index) in antDesignIcons"
48
50
  class="icon"
49
- type="step-backward"
51
+ :type="item"
50
52
  :key="index"
51
- @click="handleIconClick(icon)"
53
+ @click="handleIconClick(item)"
52
54
  />
53
55
  </div>
54
56
  </el-tabs>
@@ -80,24 +82,41 @@ export default {
80
82
  antDesign: {
81
83
  type: Boolean,
82
84
  default: false
85
+ },
86
+ active: {
87
+ type: String,
88
+ default: "tianheng"
83
89
  }
84
90
  },
85
91
  data() {
86
92
  return {
87
93
  icon: this.value,
88
- tabsActiveName: "tianheng",
94
+ activeName: this.active,
89
95
  tianhengIcons: tianhengIcons,
90
96
  elementIcons: elementIcons,
91
97
  antDesignIcons: antDesignIcons
92
98
  };
93
99
  },
94
100
  watch: {
101
+ value(val) {
102
+ if (val.indexOf("th-icon") > -1) {
103
+ this.activeName = "tianheng";
104
+ } else if (val.indexOf("el-icon") > -1) {
105
+ this.activeName = "element";
106
+ } else {
107
+ this.activeName = "antDesign";
108
+ }
109
+ this.icon = val;
110
+ },
95
111
  icon(val) {
96
112
  this.$emit("input", val);
97
113
  this.$emit("update:value", val);
98
114
  },
99
- value(val) {
100
- this.icon = val;
115
+ active(val) {
116
+ this.activeName = val;
117
+ },
118
+ activeName(val) {
119
+ this.$emit("update:active", val);
101
120
  }
102
121
  },
103
122
  created() {},
@@ -119,7 +138,10 @@ export default {
119
138
  display: flex;
120
139
  align-items: center;
121
140
  .icon {
141
+ width: 20px;
142
+ height: 20px;
122
143
  font-size: 20px;
144
+ color: #666;
123
145
  }
124
146
  }
125
147
  .th-icons-content {