@10yun/cv-mobile-ui 0.5.57 → 0.5.59

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": "@10yun/cv-mobile-ui",
3
- "version": "0.5.57",
3
+ "version": "0.5.59",
4
4
  "description": "十云cvjs移动端ui,适用uniapp",
5
5
  "homepage": "http://cvjs.cn/cv-mobile-ui/",
6
6
  "license": "Apache-2.0",
@@ -1,14 +1,12 @@
1
1
  <template>
2
- <view class="cv-dialog-bottom">
3
- <view class="cu-modal bottom-modal" :class="show ? 'show' : ''">
4
- <view class="cu-dialog">
5
- <view class="cu-bar bg-white">
6
- <view class="action text-blue" @tap="cancel">取消</view>
7
- <view class="action text-green" @tap="confirm">确定</view>
8
- </view>
9
- <view class="cv-dialog-body" :style="bodyClass">
10
- <slot name="default" />
11
- </view>
2
+ <view class="cv-dialog-bottom__wrap" :class="show ? 'show' : ''">
3
+ <view class="cv-dialog-bottom__box">
4
+ <view class="cv-dialog-bottom__bar">
5
+ <view class="action cv-dialog-bottom__bar-left" @tap="cancel">取消</view>
6
+ <view class="action cv-dialog-bottom__bar-right" @tap="confirm">确定</view>
7
+ </view>
8
+ <view class="cv-dialog-bottom__body" :style="bodyClass">
9
+ <slot name="default" />
12
10
  </view>
13
11
  </view>
14
12
  </view>
@@ -49,10 +47,7 @@ export default {
49
47
  };
50
48
  </script>
51
49
  <style>
52
- .cu-modal.bottom-modal {
53
- margin-bottom: -552px;
54
- }
55
- .cu-modal {
50
+ .cv-dialog-bottom__wrap {
56
51
  position: fixed;
57
52
  top: 0;
58
53
  right: 0;
@@ -69,32 +64,26 @@ export default {
69
64
  background: rgba(0, 0, 0, 0.6);
70
65
  transition: all 0.3s ease-in-out 0s;
71
66
  pointer-events: none;
67
+ margin-bottom: -552px;
72
68
  }
73
- .cu-modal.bottom-modal.show {
74
- margin-bottom: 0;
69
+ .cv-dialog-bottom__wrap::before {
70
+ vertical-align: bottom;
75
71
  }
76
- .cu-modal.show {
72
+ .cv-dialog-bottom__wrap::before {
73
+ content: '\200B';
74
+ display: inline-block;
75
+ height: 100%;
76
+ }
77
+ .cv-dialog-bottom__wrap.show {
77
78
  opacity: 1;
78
79
  transition-duration: 0.3s;
79
80
  transform: scale(1);
80
81
  overflow-x: hidden;
81
82
  overflow-y: auto;
82
83
  pointer-events: auto;
84
+ margin-bottom: 0;
83
85
  }
84
- .cu-modal.bottom-modal::before {
85
- vertical-align: bottom;
86
- }
87
- .cu-modal::before {
88
- content: '\200B';
89
- display: inline-block;
90
- height: 100%;
91
- vertical-align: middle;
92
- }
93
- .cu-modal.bottom-modal .cu-dialog {
94
- width: 100%;
95
- border-radius: 0;
96
- }
97
- .cu-dialog {
86
+ .cv-dialog-bottom__box {
98
87
  position: relative;
99
88
  display: inline-block;
100
89
  vertical-align: middle;
@@ -102,15 +91,14 @@ export default {
102
91
  margin-right: auto;
103
92
  width: 375px;
104
93
  max-width: 100%;
94
+ width: 100%;
105
95
  background-color: #f8f8f8;
106
- border-radius: 5px;
96
+ border-radius: 0;
97
+ border-top-left-radius: 15px;
98
+ border-top-right-radius: 15px;
107
99
  overflow: hidden;
108
100
  }
109
- .bg-white {
110
- background-color: #ffffff;
111
- color: #666666;
112
- }
113
- .cu-bar {
101
+ .cv-dialog-bottom__bar {
114
102
  display: flex;
115
103
  position: relative;
116
104
  -webkit-box-align: center;
@@ -120,19 +108,14 @@ export default {
120
108
  -webkit-box-pack: justify;
121
109
  -webkit-justify-content: space-between;
122
110
  justify-content: space-between;
111
+ background-color: #ffffff;
112
+ color: #666666;
123
113
  }
124
- .cu-modal .cu-dialog > .cu-bar:first-child .action {
114
+ .cv-dialog-bottom__bar-left {
125
115
  min-width: 55px;
126
- margin-right: 0;
127
116
  min-height: 45px;
128
- }
129
- .cu-bar .action:first-child {
117
+ margin-right: 0;
130
118
  margin-left: 16px;
131
- }
132
- .cu-bar .action:last-child {
133
- margin-right: 16px !important;
134
- }
135
- .cu-bar .action {
136
119
  display: flex;
137
120
  -webkit-box-align: center;
138
121
  -webkit-align-items: center;
@@ -142,17 +125,13 @@ export default {
142
125
  -webkit-justify-content: center;
143
126
  justify-content: center;
144
127
  max-width: 100%;
145
- font-size: 16px;
146
- }
147
- .text-green {
148
- color: #39b54a;
128
+ color: #0081ff;
149
129
  }
150
- .cu-modal .cu-dialog > .cu-bar:first-child .action {
130
+ .cv-dialog-bottom__bar-right {
151
131
  min-width: 55px;
152
- margin-right: 0;
153
132
  min-height: 45px;
154
- }
155
- .cu-bar .action {
133
+ margin-right: 16px;
134
+ font-size: 16px;
156
135
  display: flex;
157
136
  -webkit-box-align: center;
158
137
  -webkit-align-items: center;
@@ -162,11 +141,9 @@ export default {
162
141
  -webkit-justify-content: center;
163
142
  justify-content: center;
164
143
  max-width: 100%;
144
+ color: #39b54a;
165
145
  }
166
- .text-blue {
167
- color: #0081ff;
168
- }
169
- .cv-dialog-body {
146
+ .cv-dialog-bottom__body {
170
147
  padding-top: 10px;
171
148
  max-height: 500px;
172
149
  overflow: auto;
@@ -1,11 +1,12 @@
1
1
  <template>
2
- <view class="cv-dialog-bottom cv-modal bottom-modal" :class="show ? 'show' : ''">
3
- <view class="cv-dialog">
4
- <view class="cv-bar bg-white">
5
- <view class="action text-blue" @tap="cancel">取消</view>
6
- <view class="action text-green" @tap="confirm">确定</view>
2
+ <view class="cv-dialog-full__wrap" :class="localShow ? 'show' : ''">
3
+ <view class="cv-dialog-full__box">
4
+ <view class="cv-dialog-full__bar">
5
+ <view class="cv-dialog-full__bar-left" v-if="showLeft" @tap="cancel">取消</view>
6
+ <view class="cv-dialog-full__bar-title"><slot name="title">{{ title }}</slot></view>
7
+ <view class="cv-dialog-full__bar-right" v-if="showRight" @tap="confirm">确定</view>
7
8
  </view>
8
- <view class="cv-dialog-body" :style="bodyClass">
9
+ <view class="cv-dialog-full__body" :style="bodyClass">
9
10
  <slot name="default" />
10
11
  </view>
11
12
  </view>
@@ -26,14 +27,34 @@ export default {
26
27
  bodyClass: {
27
28
  type: [String],
28
29
  default: ''
30
+ },
31
+ showLeft: {
32
+ type: Boolean,
33
+ default: true
34
+ },
35
+ showRight: {
36
+ type: Boolean,
37
+ default: true
38
+ },
39
+ title: {
40
+ type: [String],
41
+ default: ''
29
42
  }
30
43
  },
31
44
  watch: {},
32
45
  data() {
33
- return {};
46
+ return {
47
+ localShow: false
48
+ };
34
49
  },
35
50
  created() {},
36
51
  methods: {
52
+ open() {
53
+ this.localShow = true;
54
+ },
55
+ close() {
56
+ this.localShow = false;
57
+ },
37
58
  confirm() {
38
59
  this.onConfirm(true);
39
60
  },
@@ -47,15 +68,12 @@ export default {
47
68
  };
48
69
  </script>
49
70
  <style>
50
- .cv-modal.bottom-modal {
51
- left: 100%;
52
- }
53
- .cv-modal {
71
+ .cv-dialog-full__wrap {
54
72
  width: 100%;
55
73
  position: fixed;
56
74
  top: 0;
57
75
  bottom: 0;
58
- left: 0;
76
+ left: 100%;
59
77
  z-index: 999;
60
78
  opacity: 0;
61
79
  outline: 0;
@@ -66,47 +84,36 @@ export default {
66
84
  transition: all 0.2s ease-in-out 0s;
67
85
  pointer-events: none;
68
86
  }
69
- .cv-modal.bottom-modal.show {
87
+ .cv-dialog-full__wrap.show {
70
88
  left: 0;
71
- }
72
- .cv-modal.show {
73
89
  opacity: 1;
74
90
  transition-duration: 0.2s;
75
91
  overflow-x: hidden;
76
92
  overflow-y: auto;
77
93
  pointer-events: auto;
78
94
  }
79
- .cv-modal.bottom-modal::before {
80
- vertical-align: bottom;
81
- }
82
- .cv-modal::before {
95
+ .cv-dialog-full__wrap::before {
83
96
  content: '\200B';
84
97
  display: inline-block;
85
98
  height: 100%;
86
99
  vertical-align: middle;
100
+ vertical-align: bottom;
87
101
  }
88
- .cv-modal.bottom-modal .cv-dialog {
102
+ .cv-dialog-full__wrap .cv-dialog {
89
103
  width: 100%;
90
104
  border-radius: 0;
91
105
  height: 100%;
92
106
  }
93
- .cv-dialog {
94
- position: relative;
107
+ .cv-dialog-full__box {
95
108
  display: inline-block;
96
109
  vertical-align: middle;
97
- margin-left: auto;
98
- margin-right: auto;
99
- width: 375px;
110
+ width: 100%;
100
111
  max-width: 100%;
101
112
  background-color: #f8f8f8;
102
- border-radius: 5px;
103
113
  overflow: hidden;
114
+ height: 100%;
104
115
  }
105
- .bg-white {
106
- background-color: #ffffff;
107
- color: #666666;
108
- }
109
- .cv-bar {
116
+ .cv-dialog-full__bar {
110
117
  display: flex;
111
118
  position: relative;
112
119
  align-items: center;
@@ -114,49 +121,35 @@ export default {
114
121
  -webkit-box-pack: justify;
115
122
  -webkit-justify-content: space-between;
116
123
  justify-content: space-between;
124
+ background-color: #ffffff;
125
+ color: #666666;
126
+ padding: 0 10px;
127
+ font-size: 15px;
117
128
  }
118
- .cv-modal .cv-dialog > .cv-bar:first-child .action {
119
- min-width: 55px;
120
- margin-right: 0;
121
- min-height: 45px;
122
- }
123
- .cv-bar .action:first-child {
124
- margin-left: 16px;
125
- }
126
- .cv-bar .action:last-child {
127
- margin-right: 16px !important;
129
+ .cv-dialog-full__bar-title {
130
+ flex: 1;
131
+ display: flex;
132
+ justify-content: center;
133
+ font-size: 15px;
134
+ font-weight: 400;
128
135
  }
129
- .cv-bar .action {
136
+ .cv-dialog-full__bar-left {
130
137
  display: flex;
131
138
  align-items: center;
132
- height: 100%;
133
139
  justify-content: center;
134
- max-width: 100%;
135
- font-size: 16px;
136
- }
137
- .text-green {
138
- color: #39b54a;
139
- }
140
- .cv-modal .cv-dialog > .cv-bar:first-child .action {
141
140
  min-width: 55px;
142
- margin-right: 0;
143
- min-height: 45px;
141
+ color: #0081ff;
144
142
  }
145
- .cv-bar .action {
143
+ .cv-dialog-full__bar-right {
146
144
  display: flex;
147
145
  align-items: center;
148
- height: 100%;
149
- -webkit-box-pack: center;
150
- -webkit-justify-content: center;
151
146
  justify-content: center;
152
- max-width: 100%;
153
- }
154
- .text-blue {
155
- color: #0081ff;
147
+ min-width: 55px;
148
+ color: #39b54a;
156
149
  }
157
- .cv-dialog-body {
150
+ .cv-dialog-full__body {
158
151
  padding: 10px;
159
- height: calc(100% - 45px - 20px);
152
+ height: calc(100% - 45px);
160
153
  overflow: auto;
161
154
  background-color: #fff;
162
155
  }
@@ -6,16 +6,7 @@
6
6
  @touchmove.stop.prevent="stopPrevent"
7
7
  :style="{ backgroundColor: backgroundColor }"
8
8
  >
9
- <view
10
- class="mask-content"
11
- @click.stop.prevent="stopPrevent"
12
- :style="[
13
- {
14
- height: config.height,
15
- transform: transform
16
- }
17
- ]"
18
- >
9
+ <view class="mask-content" @click.stop.prevent="stopPrevent" :style="[{ height: config.height, transform: transform }]">
19
10
  <scroll-view class="view-content" scroll-y>
20
11
  <view class="share-header">分享到</view>
21
12
  <view class="share-list">
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view class="container">
2
+ <view class="up-share-container">
3
3
  <text class="up-share-title">分享到</text>
4
4
  <view class="up-share-list">
5
5
  <view class="up-share-item" hover-class="up-hover" :hover-stay-time="150" v-for="(item, index) in shareList" :key="index">
@@ -41,7 +41,7 @@ export default {
41
41
  };
42
42
  </script>
43
43
  <style scoped>
44
- .container {
44
+ .up-share-container {
45
45
  padding: 0;
46
46
  background-color: #e8e8e8;
47
47
  }
@@ -4,9 +4,9 @@
4
4
  <template v-for="(item, index) in menu" :key="index">
5
5
  <view class="first-menu" :class="{ on: showPage == index }" @tap="togglePage(index)">
6
6
  <text class="name" :style="{ color: color }">{{ item.name }}</text>
7
- <!-- <cv-icons type="arrow-type1-up" size="12" class="arrows" v-if="statusList[index].isActive" />
8
- <cv-icons type="arrow-type1-down" size="12" class="arrows" v-if="!statusList[index].isActive" /> -->
9
- <cv-icons type="arrow-type1-down" size="12" color="#aaa" :style="'transform:rotate(' + triangleDeg[index] + 'deg);'" />
7
+ <!-- <cv-icons type="arrowUp" size="12" class="arrows" v-if="statusList[index].isActive" />
8
+ <cv-icons type="arrowDown" size="12" class="arrows" v-if="!statusList[index].isActive" /> -->
9
+ <cv-icons type="arrowDown" size="12" color="#aaa" :style="'transform:rotate(' + triangleDeg[index] + 'deg);'" />
10
10
  </view>
11
11
  </template>
12
12
  </view>
@@ -212,8 +212,8 @@ export default {
212
212
  this.defaultActive.length > 0
213
213
  ? this.defaultActive
214
214
  : this.activeMenuArr.length > 0
215
- ? this.activeMenuArr
216
- : tmpMenuActiveArr;
215
+ ? this.activeMenuArr
216
+ : tmpMenuActiveArr;
217
217
  this.defaultActive = [];
218
218
  this.activeMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr));
219
219
  this.shadowActiveMenuArr = JSON.parse(JSON.stringify(tmpMenuActiveArr));
@@ -641,7 +641,9 @@ export default {
641
641
  height: 13px;
642
642
  align-items: center;
643
643
  justify-content: center;
644
- transition: transform 0.2s linear, color 0.2s linear;
644
+ transition:
645
+ transform 0.2s linear,
646
+ color 0.2s linear;
645
647
  }
646
648
  .sub-menu-class {
647
649
  width: 100%;
@@ -11,14 +11,14 @@
11
11
  auto-height
12
12
  />
13
13
  <view @tap="chooseLocation" class="cv-geo-local-button">
14
- <cv-icons type="actionSearch" size="20" color="#999999" />
14
+ <cv-icons type="geoLocateoutline" size="20" color="#999999" />
15
15
  </view>
16
16
  </view>
17
17
  <view class="cv-geo-local-map" v-if="isShowMap">
18
18
  <map
19
19
  style="width: 100%; height: 170px"
20
- :longitude="map_location.longitude"
21
- :latitude="map_location.latitude"
20
+ :longitude="localLongitude"
21
+ :latitude="localLatitude"
22
22
  :scale="localScale"
23
23
  show-location
24
24
  :markers="markers"
@@ -32,7 +32,7 @@ import mixin from '../../libs/mixin/mixin.js';
32
32
  export default {
33
33
  mixins: [mpMixin, mixin],
34
34
  name: 'cvGeoLocal',
35
- emits: ['input', 'update:modelValue', 'location'],
35
+ emits: ['input', 'update:modelValue', 'update:longitude', 'update:latitude'],
36
36
  props: {
37
37
  value: {
38
38
  type: [Number, String],
@@ -42,6 +42,16 @@ export default {
42
42
  type: [Number, String],
43
43
  default: ''
44
44
  },
45
+ // 经度
46
+ longitude: {
47
+ type: [Number, String],
48
+ default: ''
49
+ },
50
+ // 纬度
51
+ latitude: {
52
+ type: [Number, String],
53
+ default: ''
54
+ },
45
55
  placeholder: {
46
56
  type: [String],
47
57
  default: '请输入定位地址'
@@ -83,7 +93,13 @@ export default {
83
93
  }
84
94
  }
85
95
  },
86
- location(n) {
96
+ longitude(n) {
97
+ if (this.isShowMap) {
98
+ console.log('change:location');
99
+ this.initLocation();
100
+ }
101
+ },
102
+ latitude(n) {
87
103
  if (this.isShowMap) {
88
104
  console.log('change:location');
89
105
  this.initLocation();
@@ -111,10 +127,8 @@ export default {
111
127
  markers: [],
112
128
  //当前选择的位置
113
129
  localScale: 14,
114
- map_location: {
115
- longitude: 119.296411,
116
- latitude: 26.074286
117
- },
130
+ localLongitude: 119.296411,
131
+ localLatitude: 26.074286,
118
132
  parentObj: null
119
133
  };
120
134
  },
@@ -173,12 +187,12 @@ export default {
173
187
  this.funcOnInput();
174
188
  },
175
189
  initLocation() {
176
- if (this.location.longitude && this.location.latitude) {
177
- this.map_location = this.location;
190
+ if (this.longitude && this.latitude) {
191
+ this.localLongitude = this.longitude;
192
+ this.localLatitude = this.latitude;
178
193
  }
179
- console.log('--', this.map_location);
180
194
  if (this.localVal) {
181
- this.map_location['address'] = this.localVal;
195
+ this.localVal = this.localVal;
182
196
  }
183
197
  },
184
198
  chooseLocation() {
@@ -188,9 +202,11 @@ export default {
188
202
  console.log(res);
189
203
  if (res.errMsg == 'chooseLocation:ok') {
190
204
  this.localVal = res.address || '';
191
- this.map_location = { ...res };
205
+ this.localLongitude = res.longitude || '';
206
+ this.localLatitude = res.latitude || '';
192
207
  this.localScale = 16;
193
- this.$emit('location', { ...res });
208
+ this.$emit('update:longitude', this.localLongitude);
209
+ this.$emit('update:latitude', this.localLatitude);
194
210
  this.funcOnInput();
195
211
  }
196
212
  }
@@ -198,12 +214,11 @@ export default {
198
214
  },
199
215
  initMarkers() {
200
216
  let markers = [];
201
- let map_location = this.map_location;
202
217
  markers.push({
203
- latitude: map_location.latitude,
204
- longitude: map_location.longitude,
218
+ latitude: this.localLatitude,
219
+ longitude: this.localLongitude,
205
220
  callout: {
206
- content: map_location.address,
221
+ content: this.localVal,
207
222
  color: '#333333',
208
223
  borderRadius: 5,
209
224
  bgColor: '#ffffff',
@@ -224,6 +239,7 @@ export default {
224
239
  display: flex;
225
240
  flex-direction: column;
226
241
  width: 100%;
242
+ position: relative;
227
243
  }
228
244
  .cv-geo-local-info {
229
245
  display: flex;
@@ -28,9 +28,21 @@ import mpMixin from '../../libs/mixin/mpMixin.js';
28
28
  import mixin from '../../libs/mixin/mixin.js';
29
29
  export default {
30
30
  mixins: [mpMixin, mixin],
31
- name: 'cvPickerRegion',
32
- emits: ['input', 'update:modelValue', 'onChoose'],
31
+ name: 'cvGeoRegion',
32
+ emits: ['input', 'update:modelValue', 'update:province', 'update:city', 'update:district', 'onChoose'],
33
33
  props: {
34
+ province: {
35
+ type: [String, Number],
36
+ default: ''
37
+ },
38
+ city: {
39
+ type: [String, Number],
40
+ default: ''
41
+ },
42
+ district: {
43
+ type: [String, Number],
44
+ default: ''
45
+ },
34
46
  value: {
35
47
  type: [Array, Object],
36
48
  default: () => []
@@ -54,6 +66,18 @@ export default {
54
66
  }
55
67
  },
56
68
  watch: {
69
+ province(newVal) {
70
+ this.localVal[0] = newVal;
71
+ this.itemsSortOut();
72
+ },
73
+ city(newVal) {
74
+ this.localVal[1] = newVal;
75
+ this.itemsSortOut();
76
+ },
77
+ district(newVal) {
78
+ this.localVal[2] = newVal;
79
+ this.itemsSortOut();
80
+ },
57
81
  value(newVal) {
58
82
  this.localVal = newVal;
59
83
  this.itemsSortOut();
@@ -71,7 +95,7 @@ export default {
71
95
  last_range_data: [], //最终显示页面数组
72
96
  items_index: [0, 0, 0], //当前下标
73
97
  lastRetDataIndex: [0, 0, 0], // 最终确定选中的下标
74
- localDataType: 'text',
98
+ localValField: 'text',
75
99
  localDataValue: 'value',
76
100
  localDataText: 'label',
77
101
  localProvince: {},
@@ -81,7 +105,7 @@ export default {
81
105
  },
82
106
  created() {
83
107
  this.localVal = this.doValueGet();
84
- this.localDataType = this.dataType != 'value' ? 'text' : 'value';
108
+ this.localValField = this.dataType != 'value' ? 'text' : 'value';
85
109
  this.itemsSortOut();
86
110
  },
87
111
  methods: {
@@ -146,7 +170,7 @@ export default {
146
170
  if (localValue) {
147
171
  /* 便利省级列表 找出省级的位置 */
148
172
  for (const key in data) {
149
- if (localValue == data[key][this.localDataType]) {
173
+ if (localValue == data[key][this.localValField]) {
150
174
  localKey = parseInt(key);
151
175
  }
152
176
  }
@@ -203,18 +227,18 @@ export default {
203
227
  this.lastRetDataIndex = [...items_index];
204
228
  let value = [];
205
229
  let items = this.items;
206
- if (this.localDataType == 'text') {
207
- value[0] = this.range_data[0][items_index[0]].text;
208
- value[1] = this.range_data[1][items_index[1]].text;
209
- value[2] = this.range_data[2][items_index[2]].text;
210
- } else {
211
- value[0] = this.range_data[0][items_index[0]].value;
212
- value[1] = this.range_data[1][items_index[1]].value;
213
- value[2] = this.range_data[2][items_index[2]].value;
214
- }
230
+ let item_key = this.localValField == 'text' ? 'text' : 'value';
231
+ value[0] = this.range_data[0][items_index[0]][item_key];
232
+ value[1] = this.range_data[1][items_index[1]][item_key];
233
+ value[2] = this.range_data[2][items_index[2]][item_key];
234
+
215
235
  this.$emit('input', value);
216
236
  this.$emit('update:modelValue', value);
217
237
 
238
+ this.$emit('update:province', value[0]);
239
+ this.$emit('update:city', value[1]);
240
+ this.$emit('update:district', value[2]);
241
+
218
242
  // 把选中的3个数组传递出去
219
243
 
220
244
  let selectAllArr = {
@@ -1,12 +1,8 @@
1
- <!-- <text :style="{ color: color, 'font-size': size + 'px' }" class="cv-icons" :class="rotate ? 'cv-icons-turn' : ''">
1
+ <!-- <text :style="mergeIconStyle" class="cv-icons" :class="rotate ? 'cv-icons-turn' : ''">
2
2
  {{ icons[type] }}
3
3
  </text> -->
4
4
  <template>
5
- <text
6
- :style="{ color: color, 'font-size': size + 'px' }"
7
- class="cv-icon"
8
- :class="rotate ? 'cv-icons-turn' : 'cv-icon-' + type"
9
- ></text>
5
+ <text :style="mergeIconStyle" class="cv-icon" :class="rotate ? 'cv-icons-turn' : 'cv-icon-' + type"></text>
10
6
  </template>
11
7
 
12
8
  <script>
@@ -44,6 +40,21 @@ export default {
44
40
  }
45
41
  }
46
42
  },
43
+ computed: {
44
+ mergeIconStyle() {
45
+ let sizePx = '';
46
+ if (typeof this.size === 'string' && (this.size.includes('px') || this.size.includes('rpx'))) {
47
+ sizePx = this.size;
48
+ } else {
49
+ sizePx = `${parseFloat(this.size)}px`;
50
+ }
51
+ return {
52
+ color: this.color,
53
+ height: sizePx,
54
+ 'font-size': sizePx
55
+ };
56
+ }
57
+ },
47
58
  data() {
48
59
  return {
49
60
  // icons: icons