@vtj/materials 0.13.15 → 0.13.17

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.
Files changed (127) hide show
  1. package/dist/assets/antdv/index.umd.js +2 -2
  2. package/dist/assets/charts/index.umd.js +2 -2
  3. package/dist/assets/element/index.umd.js +3 -3
  4. package/dist/assets/icons/index.umd.js +2 -2
  5. package/dist/assets/ui/index.umd.js +2 -2
  6. package/dist/assets/uni-h5/index.umd.js +2 -2
  7. package/dist/assets/uni-ui/index.umd.js +2 -2
  8. package/dist/assets/vant/index.umd.js +2 -2
  9. package/dist/deps/@vtj/charts/index.umd.js +2 -2
  10. package/dist/deps/@vtj/icons/index.umd.js +2 -2
  11. package/dist/deps/@vtj/ui/index.umd.js +4 -4
  12. package/dist/deps/@vtj/ui/style.css +1 -1
  13. package/dist/deps/@vtj/utils/index.umd.js +28 -33
  14. package/dist/deps/@vueuse/core/index.iife.min.js +1 -1
  15. package/dist/deps/element-plus/index.css +1 -1
  16. package/dist/deps/element-plus/index.full.min.js +14 -14
  17. package/dist/deps/element-plus/zh-cn.js +1 -1
  18. package/dist/deps/uni-app/index.umd.js +1 -1
  19. package/dist/deps/uni-h5/index.umd.js +8 -8
  20. package/dist/deps/uni-h5/style.css +1 -1
  21. package/dist/deps/uni-h5-vue/index.umd.js +1 -1
  22. package/dist/deps/uni-ui/index.umd.js +6 -1
  23. package/dist/deps/uni-ui/style.css +1 -1
  24. package/dist/deps/vue/vue.global.js +88 -53
  25. package/dist/deps/vue/vue.global.prod.js +9 -9
  26. package/package.json +12 -12
  27. package/src/antdv/image.ts +1 -1
  28. package/src/element/image.ts +1 -1
  29. package/src/element/virtualizedTable.ts +6 -6
  30. package/src/manifest.json +69 -0
  31. package/src/pages/index.vue +2 -0
  32. package/src/pages.json +19 -0
  33. package/src/uni-ui/index.ts +88 -58
  34. package/src/{uni-ui/lib/uni.scss → uni.scss} +4 -0
  35. package/src/version.ts +2 -2
  36. package/src/uni-ui/lib/uni-col/uni-col.vue +0 -324
  37. package/src/uni-ui/lib/uni-collapse/uni-collapse.vue +0 -153
  38. package/src/uni-ui/lib/uni-collapse-item/uni-collapse-item.vue +0 -425
  39. package/src/uni-ui/lib/uni-data-picker/keypress.js +0 -45
  40. package/src/uni-ui/lib/uni-data-picker/uni-data-picker.vue +0 -604
  41. package/src/uni-ui/lib/uni-data-pickerview/uni-data-picker.js +0 -622
  42. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.css +0 -76
  43. package/src/uni-ui/lib/uni-data-pickerview/uni-data-pickerview.vue +0 -335
  44. package/src/uni-ui/lib/uni-data-select/uni-data-select.vue +0 -590
  45. package/src/uni-ui/lib/uni-datetime-picker/calendar-item.vue +0 -188
  46. package/src/uni-ui/lib/uni-datetime-picker/calendar.vue +0 -985
  47. package/src/uni-ui/lib/uni-datetime-picker/i18n/en.json +0 -22
  48. package/src/uni-ui/lib/uni-datetime-picker/i18n/index.js +0 -8
  49. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hans.json +0 -22
  50. package/src/uni-ui/lib/uni-datetime-picker/i18n/zh-Hant.json +0 -22
  51. package/src/uni-ui/lib/uni-datetime-picker/time-picker.vue +0 -1032
  52. package/src/uni-ui/lib/uni-datetime-picker/uni-datetime-picker.vue +0 -1230
  53. package/src/uni-ui/lib/uni-datetime-picker/util.js +0 -448
  54. package/src/uni-ui/lib/uni-easyinput/common.js +0 -54
  55. package/src/uni-ui/lib/uni-easyinput/uni-easyinput.vue +0 -790
  56. package/src/uni-ui/lib/uni-fav/i18n/en.json +0 -4
  57. package/src/uni-ui/lib/uni-fav/i18n/index.js +0 -8
  58. package/src/uni-ui/lib/uni-fav/i18n/zh-Hans.json +0 -4
  59. package/src/uni-ui/lib/uni-fav/i18n/zh-Hant.json +0 -4
  60. package/src/uni-ui/lib/uni-fav/uni-fav.vue +0 -170
  61. package/src/uni-ui/lib/uni-file-picker/choose-and-upload-file.js +0 -280
  62. package/src/uni-ui/lib/uni-file-picker/uni-file-picker.vue +0 -668
  63. package/src/uni-ui/lib/uni-file-picker/upload-file.vue +0 -325
  64. package/src/uni-ui/lib/uni-file-picker/upload-image.vue +0 -292
  65. package/src/uni-ui/lib/uni-file-picker/utils.js +0 -110
  66. package/src/uni-ui/lib/uni-forms/uni-forms.vue +0 -416
  67. package/src/uni-ui/lib/uni-forms/utils.js +0 -293
  68. package/src/uni-ui/lib/uni-forms/validate.js +0 -486
  69. package/src/uni-ui/lib/uni-forms-item/uni-forms-item.vue +0 -630
  70. package/src/uni-ui/lib/uni-goods-nav/i18n/en.json +0 -6
  71. package/src/uni-ui/lib/uni-goods-nav/i18n/index.js +0 -8
  72. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hans.json +0 -6
  73. package/src/uni-ui/lib/uni-goods-nav/i18n/zh-Hant.json +0 -6
  74. package/src/uni-ui/lib/uni-goods-nav/uni-goods-nav.vue +0 -231
  75. package/src/uni-ui/lib/uni-grid/uni-grid.vue +0 -148
  76. package/src/uni-ui/lib/uni-icons/uni-icons.uvue +0 -91
  77. package/src/uni-ui/lib/uni-icons/uni-icons.vue +0 -114
  78. package/src/uni-ui/lib/uni-icons/uniicons.css +0 -664
  79. package/src/uni-ui/lib/uni-icons/uniicons.ttf +0 -0
  80. package/src/uni-ui/lib/uni-icons/uniicons_file.ts +0 -664
  81. package/src/uni-ui/lib/uni-icons/uniicons_file_vue.js +0 -649
  82. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list-item.vue +0 -168
  83. package/src/uni-ui/lib/uni-indexed-list/uni-indexed-list.vue +0 -404
  84. package/src/uni-ui/lib/uni-list/uni-list.vue +0 -123
  85. package/src/uni-ui/lib/uni-list/uni-refresh.vue +0 -65
  86. package/src/uni-ui/lib/uni-list/uni-refresh.wxs +0 -87
  87. package/src/uni-ui/lib/uni-load-more/i18n/en.json +0 -5
  88. package/src/uni-ui/lib/uni-load-more/i18n/index.js +0 -8
  89. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hans.json +0 -5
  90. package/src/uni-ui/lib/uni-load-more/i18n/zh-Hant.json +0 -5
  91. package/src/uni-ui/lib/uni-load-more/uni-load-more.vue +0 -456
  92. package/src/uni-ui/lib/uni-notice-bar/uni-notice-bar.vue +0 -484
  93. package/src/uni-ui/lib/uni-popup/i18n/en.json +0 -7
  94. package/src/uni-ui/lib/uni-popup/i18n/index.js +0 -8
  95. package/src/uni-ui/lib/uni-popup/i18n/zh-Hans.json +0 -7
  96. package/src/uni-ui/lib/uni-popup/i18n/zh-Hant.json +0 -7
  97. package/src/uni-ui/lib/uni-popup/keypress.js +0 -45
  98. package/src/uni-ui/lib/uni-popup/popup.js +0 -26
  99. package/src/uni-ui/lib/uni-popup/uni-popup.uvue +0 -90
  100. package/src/uni-ui/lib/uni-popup/uni-popup.vue +0 -552
  101. package/src/uni-ui/lib/uni-popup-dialog/keypress.js +0 -45
  102. package/src/uni-ui/lib/uni-popup-dialog/uni-popup-dialog.vue +0 -324
  103. package/src/uni-ui/lib/uni-popup-message/uni-popup-message.vue +0 -149
  104. package/src/uni-ui/lib/uni-rate/uni-rate.vue +0 -380
  105. package/src/uni-ui/lib/uni-row/uni-row.vue +0 -193
  106. package/src/uni-ui/lib/uni-search-bar/i18n/en.json +0 -4
  107. package/src/uni-ui/lib/uni-search-bar/i18n/index.js +0 -8
  108. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hans.json +0 -4
  109. package/src/uni-ui/lib/uni-search-bar/i18n/zh-Hant.json +0 -4
  110. package/src/uni-ui/lib/uni-search-bar/uni-search-bar.vue +0 -339
  111. package/src/uni-ui/lib/uni-swipe-action-item/bindingx.js +0 -311
  112. package/src/uni-ui/lib/uni-swipe-action-item/isPC.js +0 -12
  113. package/src/uni-ui/lib/uni-swipe-action-item/mpalipay.js +0 -195
  114. package/src/uni-ui/lib/uni-swipe-action-item/mpother.js +0 -260
  115. package/src/uni-ui/lib/uni-swipe-action-item/mpwxs.js +0 -84
  116. package/src/uni-ui/lib/uni-swipe-action-item/render.js +0 -270
  117. package/src/uni-ui/lib/uni-swipe-action-item/uni-swipe-action-item.vue +0 -493
  118. package/src/uni-ui/lib/uni-swipe-action-item/wx.wxs +0 -341
  119. package/src/uni-ui/lib/uni-table/uni-table.vue +0 -496
  120. package/src/uni-ui/lib/uni-td/uni-td.vue +0 -99
  121. package/src/uni-ui/lib/uni-th/filter-dropdown.vue +0 -559
  122. package/src/uni-ui/lib/uni-th/uni-th.vue +0 -322
  123. package/src/uni-ui/lib/uni-tr/table-checkbox.vue +0 -181
  124. package/src/uni-ui/lib/uni-tr/uni-tr.vue +0 -208
  125. package/src/uni-ui/lib/uni-transition/createAnimation.js +0 -131
  126. package/src/uni-ui/lib/uni-transition/uni-transition.vue +0 -310
  127. package/src/uni-ui/polyfill.ts +0 -41
@@ -1,231 +0,0 @@
1
- <template>
2
- <view class="uni-goods-nav">
3
- <!-- 底部占位 -->
4
- <view class="uni-tab__seat" />
5
- <view class="uni-tab__cart-box flex">
6
- <view class="flex uni-tab__cart-sub-left">
7
- <view v-for="(item,index) in options" :key="index" class="flex uni-tab__cart-button-left uni-tab__shop-cart" @click="onClick(index,item)">
8
- <view class="uni-tab__icon">
9
- <uni-icons :type="item.icon" size="20" color="#646566"></uni-icons>
10
- <!-- <image class="image" :src="item.icon" mode="widthFix" /> -->
11
- </view>
12
- <text class="uni-tab__text">{{ item.text }}</text>
13
- <view class="flex uni-tab__dot-box">
14
- <text v-if="item.info" :class="{ 'uni-tab__dots': item.info > 9 }" class="uni-tab__dot " :style="{'backgroundColor':item.infoBackgroundColor?item.infoBackgroundColor:'#ff0000',
15
- color:item.infoColor?item.infoColor:'#fff'
16
- }">{{ item.info }}</text>
17
- </view>
18
- </view>
19
- </view>
20
- <view :class="{'uni-tab__right':fill}" class="flex uni-tab__cart-sub-right ">
21
- <view v-for="(item,index) in buttonGroup" :key="index" :style="{background:item.backgroundColor,color:item.color}"
22
- class="flex uni-tab__cart-button-right" @click="buttonClick(index,item)"><text :style="{color:item.color}" class="uni-tab__cart-button-right-text">{{ item.text }}</text></view>
23
- </view>
24
- </view>
25
- </view>
26
- </template>
27
-
28
- <script>
29
- import {
30
- initVueI18n
31
- } from '@dcloudio/uni-i18n'
32
- import messages from './i18n/index.js'
33
- const { t } = initVueI18n(messages)
34
- /**
35
- * GoodsNav 商品导航
36
- * @description 商品加入购物车、立即购买等
37
- * @tutorial https://ext.dcloud.net.cn/plugin?id=865
38
- * @property {Array} options 组件参数
39
- * @property {Array} buttonGroup 组件按钮组参数
40
- * @property {Boolean} fill = [true | false] 组件按钮组参数
41
- * @property {Boolean} stat 是否开启统计功能
42
- * @event {Function} click 左侧点击事件
43
- * @event {Function} buttonClick 右侧按钮组点击事件
44
- * @example <uni-goods-nav :fill="true" options="" buttonGroup="buttonGroup" @click="" @buttonClick="" />
45
- */
46
- export default {
47
- name: 'UniGoodsNav',
48
- emits:['click','buttonClick'],
49
- props: {
50
- options: {
51
- type: Array,
52
- default () {
53
- return [{
54
- icon: 'shop',
55
- text: t("uni-goods-nav.options.shop"),
56
- }, {
57
- icon: 'cart',
58
- text: t("uni-goods-nav.options.cart")
59
- }]
60
- }
61
- },
62
- buttonGroup: {
63
- type: Array,
64
- default () {
65
- return [{
66
- text: t("uni-goods-nav.buttonGroup.addToCart"),
67
- backgroundColor: 'linear-gradient(90deg, #FFCD1E, #FF8A18)',
68
- color: '#fff'
69
- },
70
- {
71
- text: t("uni-goods-nav.buttonGroup.buyNow"),
72
- backgroundColor: 'linear-gradient(90deg, #FE6035, #EF1224)',
73
- color: '#fff'
74
- }
75
- ]
76
- }
77
- },
78
- fill: {
79
- type: Boolean,
80
- default: false
81
- },
82
- stat:{
83
- type: Boolean,
84
- default: false
85
- }
86
- },
87
- methods: {
88
- onClick(index, item) {
89
- this.$emit('click', {
90
- index,
91
- content: item,
92
- })
93
- },
94
- buttonClick(index, item) {
95
- if (uni.report && this.stat) {
96
- uni.report(item.text, item.text)
97
- }
98
- this.$emit('buttonClick', {
99
- index,
100
- content: item
101
- })
102
- }
103
- }
104
- }
105
- </script>
106
-
107
- <style lang="scss" >
108
- .flex {
109
- /* #ifndef APP-NVUE */
110
- display: flex;
111
- /* #endif */
112
- flex-direction: row;
113
- }
114
-
115
- .uni-goods-nav {
116
- /* #ifndef APP-NVUE */
117
- display: flex;
118
- /* #endif */
119
- flex: 1;
120
- flex-direction: row;
121
- }
122
-
123
- .uni-tab__cart-box {
124
- flex: 1;
125
- height: 50px;
126
- background-color: #fff;
127
- z-index: 900;
128
- }
129
-
130
- .uni-tab__cart-sub-left {
131
- padding: 0 5px;
132
- display: flex;
133
- flex-direction: row;
134
- }
135
-
136
- .uni-tab__cart-sub-right {
137
- flex: 1;
138
- }
139
-
140
- .uni-tab__right {
141
- margin: 5px 0;
142
- margin-right: 10px;
143
- border-radius: 100px;
144
- overflow: hidden;
145
- }
146
-
147
- .uni-tab__cart-button-left {
148
- /* #ifndef APP-NVUE */
149
- display: flex;
150
- /* #endif */
151
- // flex: 1;
152
- position: relative;
153
- justify-content: center;
154
- align-items: center;
155
- flex-direction: column;
156
- margin: 0 10px;
157
- /* #ifdef H5 */
158
- cursor: pointer;
159
- /* #endif */
160
- }
161
-
162
- .uni-tab__icon {
163
- width: 18px;
164
- height: 18px;
165
- }
166
-
167
- .image {
168
- width: 18px;
169
- height: 18px;
170
- }
171
-
172
- .uni-tab__text {
173
- margin-top: 3px;
174
- font-size: 12px;
175
- color: #646566;
176
- }
177
-
178
- .uni-tab__cart-button-right {
179
- /* #ifndef APP-NVUE */
180
- display: flex;
181
- flex-direction: column;
182
- /* #endif */
183
- flex: 1;
184
- justify-content: center;
185
- align-items: center;
186
- /* #ifdef H5 */
187
- cursor: pointer;
188
- /* #endif */
189
- }
190
-
191
- .uni-tab__cart-button-right-text {
192
- font-size: 14px;
193
- color: #fff;
194
- }
195
-
196
- .uni-tab__cart-button-right:active {
197
- opacity: 0.7;
198
- }
199
-
200
- .uni-tab__dot-box {
201
- /* #ifndef APP-NVUE */
202
- display: flex;
203
- flex-direction: column;
204
- /* #endif */
205
- position: absolute;
206
- right: -2px;
207
- top: 2px;
208
- justify-content: center;
209
- align-items: center;
210
- // width: 0;
211
- // height: 0;
212
- }
213
-
214
- .uni-tab__dot {
215
- // width: 30rpx;
216
- // height: 30rpx;
217
- padding: 0 4px;
218
- line-height: 15px;
219
- color: #ffffff;
220
- text-align: center;
221
- font-size: 12px;
222
- background-color: #ff0000;
223
- border-radius: 15px;
224
- }
225
-
226
- .uni-tab__dots {
227
- padding: 0 4px;
228
- // width: auto;
229
- border-radius: 15px;
230
- }
231
- </style>
@@ -1,148 +0,0 @@
1
- <template>
2
- <view class="uni-grid-wrap">
3
- <view
4
- :id="elId"
5
- ref="uni-grid"
6
- class="uni-grid"
7
- :class="{ 'uni-grid--border': showBorder }"
8
- :style="{ 'border-left-color': borderColor }">
9
- <slot />
10
- </view>
11
- </view>
12
- </template>
13
-
14
- <script>
15
- // #ifdef APP-NVUE
16
- const dom = uni.requireNativePlugin('dom');
17
- // #endif
18
-
19
- /**
20
- * Grid 宫格
21
- * @description 宫格组件
22
- * @tutorial https://ext.dcloud.net.cn/plugin?id=27
23
- * @property {Number} column 每列显示个数
24
- * @property {String} borderColor 边框颜色
25
- * @property {Boolean} showBorder 是否显示边框
26
- * @property {Boolean} square 是否方形显示
27
- * @property {Boolean} Boolean 点击背景是否高亮
28
- * @event {Function} change 点击 grid 触发,e={detail:{index:0}},index 为当前点击 gird 下标
29
- */
30
- export default {
31
- name: 'UniGrid',
32
- emits: ['change'],
33
- props: {
34
- // 每列显示个数
35
- column: {
36
- type: Number,
37
- default: 3
38
- },
39
- // 是否显示边框
40
- showBorder: {
41
- type: Boolean,
42
- default: true
43
- },
44
- // 边框颜色
45
- borderColor: {
46
- type: String,
47
- default: '#D2D2D2'
48
- },
49
- // 是否正方形显示,默认为 true
50
- square: {
51
- type: Boolean,
52
- default: true
53
- },
54
- highlight: {
55
- type: Boolean,
56
- default: true
57
- }
58
- },
59
- provide() {
60
- return {
61
- grid: this
62
- };
63
- },
64
- data() {
65
- const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`;
66
- return {
67
- elId,
68
- width: 0
69
- };
70
- },
71
- created() {
72
- this.children = [];
73
- },
74
- mounted() {
75
- this.$nextTick(() => {
76
- this.init();
77
- });
78
- },
79
- methods: {
80
- init() {
81
- setTimeout(() => {
82
- this._getSize((width) => {
83
- this.children.forEach((item, index) => {
84
- item.width = width;
85
- });
86
- });
87
- }, 50);
88
- },
89
- change(e) {
90
- this.$emit('change', e);
91
- },
92
- _getSize(fn) {
93
- // #ifndef APP-NVUE
94
- uni
95
- .createSelectorQuery()
96
- .in(this)
97
- .select(`#${this.elId}`)
98
- .boundingClientRect()
99
- .exec((ret) => {
100
- this.width = parseInt((ret[0].width - 1) / this.column) + 'px';
101
- fn(this.width);
102
- });
103
- // #endif
104
- // #ifdef APP-NVUE
105
- // dom.getComponentRect(this.$refs['uni-grid'], (ret) => {
106
- // this.width = parseInt((ret.size.width - 1) / this.column) + 'px'
107
- // fn(this.width)
108
- // })
109
- // #endif
110
- }
111
- }
112
- };
113
- </script>
114
-
115
- <style lang="scss" scoped>
116
- .uni-grid-wrap {
117
- /* #ifndef APP-NVUE */
118
- display: flex;
119
- /* #endif */
120
- flex: 1;
121
- flex-direction: column;
122
- /* #ifdef H5 */
123
- width: 100%;
124
- /* #endif */
125
- }
126
-
127
- .uni-grid {
128
- /* #ifndef APP-NVUE */
129
- display: flex;
130
- /* #endif */
131
- // flex: 1;
132
- flex-direction: row;
133
- flex-wrap: wrap;
134
- }
135
-
136
- .uni-grid--border {
137
- position: relative;
138
- /* #ifdef APP-NVUE */
139
- border-left-color: #d2d2d2;
140
- border-left-style: solid;
141
- border-left-width: 0.5px;
142
- /* #endif */
143
- /* #ifndef APP-NVUE */
144
- z-index: 1;
145
- border-left: 1px #d2d2d2 solid;
146
- /* #endif */
147
- }
148
- </style>
@@ -1,91 +0,0 @@
1
- <template>
2
- <text class="uni-icons" :style="styleObj">
3
- <slot>{{unicode}}</slot>
4
- </text>
5
- </template>
6
-
7
- <script>
8
- import { fontData, IconsDataItem } from './uniicons_file'
9
-
10
- /**
11
- * Icons 图标
12
- * @description 用于展示 icon 图标
13
- * @tutorial https://ext.dcloud.net.cn/plugin?id=28
14
- * @property {Number} size 图标大小
15
- * @property {String} type 图标图案,参考示例
16
- * @property {String} color 图标颜色
17
- * @property {String} customPrefix 自定义图标
18
- * @event {Function} click 点击 Icon 触发事件
19
- */
20
- export default {
21
- name: "uni-icons",
22
- props: {
23
- type: {
24
- type: String,
25
- default: ''
26
- },
27
- color: {
28
- type: String,
29
- default: '#333333'
30
- },
31
- size: {
32
- type: Object,
33
- default: 16
34
- },
35
- fontFamily: {
36
- type: String,
37
- default: ''
38
- }
39
- },
40
- data() {
41
- return {};
42
- },
43
- computed: {
44
- unicode() : string {
45
- let codes = fontData.find((item : IconsDataItem) : boolean => { return item.font_class == this.type })
46
- if (codes !== null) {
47
- return codes.unicode
48
- }
49
- return ''
50
- },
51
- iconSize() : string {
52
- const size = this.size
53
- if (typeof size == 'string') {
54
- const reg = /^[0-9]*$/g
55
- return reg.test(size as string) ? '' + size + 'px' : '' + size;
56
- // return '' + this.size
57
- }
58
- return this.getFontSize(size as number)
59
- },
60
- styleObj() : UTSJSONObject {
61
- if (this.fontFamily !== '') {
62
- return { color: this.color, fontSize: this.iconSize, fontFamily: this.fontFamily }
63
- }
64
- return { color: this.color, fontSize: this.iconSize }
65
- }
66
- },
67
- created() { },
68
- methods: {
69
- /**
70
- * 字体大小
71
- */
72
- getFontSize(size : number) : string {
73
- return size + 'px';
74
- },
75
- },
76
- }
77
- </script>
78
-
79
- <style scoped>
80
- @font-face {
81
- font-family: UniIconsFontFamily;
82
- src: url('./uniicons.ttf');
83
- }
84
-
85
- .uni-icons {
86
- font-family: UniIconsFontFamily;
87
- font-size: 18px;
88
- font-style: normal;
89
- color: #333;
90
- }
91
- </style>
@@ -1,114 +0,0 @@
1
- <template>
2
- <!-- #ifdef APP-NVUE -->
3
- <!-- <text :style="styleObj" class="uni-icons" @click="_onClick">{{unicode}}</text> -->
4
- <!-- #endif -->
5
- <!-- #ifndef APP-NVUE -->
6
- <text
7
- :style="styleObj"
8
- class="uni-icons"
9
- :class="['uniui-' + type, customPrefix, customPrefix ? type : '']"
10
- @click="_onClick">
11
- <slot></slot>
12
- </text>
13
- <!-- #endif -->
14
- </template>
15
-
16
- <script>
17
- import { fontData } from './uniicons_file_vue.js';
18
-
19
- const getVal = (val) => {
20
- const reg = /^[0-9]*$/g;
21
- return typeof val === 'number' || reg.test(val) ? val + 'px' : val;
22
- };
23
-
24
- // #ifdef APP-NVUE
25
- var domModule = weex.requireModule('dom');
26
- import iconUrl from './uniicons.ttf';
27
- domModule.addRule('fontFace', {
28
- fontFamily: 'uniicons',
29
- src: "url('" + iconUrl + "')"
30
- });
31
- // #endif
32
-
33
- /**
34
- * Icons 图标
35
- * @description 用于展示 icons 图标
36
- * @tutorial https://ext.dcloud.net.cn/plugin?id=28
37
- * @property {Number} size 图标大小
38
- * @property {String} type 图标图案,参考示例
39
- * @property {String} color 图标颜色
40
- * @property {String} customPrefix 自定义图标
41
- * @event {Function} click 点击 Icon 触发事件
42
- */
43
- export default {
44
- name: 'UniIcons',
45
- emits: ['click'],
46
- props: {
47
- type: {
48
- type: String,
49
- default: ''
50
- },
51
- color: {
52
- type: String,
53
- default: '#333333'
54
- },
55
- size: {
56
- type: [Number, String],
57
- default: 16
58
- },
59
- customPrefix: {
60
- type: String,
61
- default: ''
62
- },
63
- fontFamily: {
64
- type: String,
65
- default: ''
66
- }
67
- },
68
- data() {
69
- return {
70
- icons: fontData
71
- };
72
- },
73
- computed: {
74
- unicode() {
75
- let code = this.icons.find((v) => v.font_class === this.type);
76
- if (code) {
77
- return code.unicode;
78
- }
79
- return '';
80
- },
81
- iconSize() {
82
- return getVal(this.size);
83
- },
84
- styleObj() {
85
- if (this.fontFamily !== '') {
86
- return `color: ${this.color}; font-size: ${this.iconSize}; font-family: ${this.fontFamily};`;
87
- }
88
- return `color: ${this.color}; font-size: ${this.iconSize};`;
89
- }
90
- },
91
- methods: {
92
- _onClick() {
93
- this.$emit('click');
94
- }
95
- }
96
- };
97
- </script>
98
-
99
- <style lang="scss">
100
- /* #ifndef APP-NVUE */
101
- @import './uniicons.css';
102
-
103
- @font-face {
104
- font-family: uniicons;
105
- src: url('./uniicons.ttf');
106
- }
107
-
108
- /* #endif */
109
- .uni-icons {
110
- font-family: uniicons;
111
- text-decoration: none;
112
- text-align: center;
113
- }
114
- </style>