create-uniapps 1.0.2 → 1.0.4

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": "create-uniapps",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "UniApps template",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,11 +1,11 @@
1
1
  {
2
- "name": "uni-preset-vue",
2
+ "name": "uniapp-template-vue3-vite-tailwindcss",
3
3
  "version": "0.0.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
- "name": "uni-preset-vue",
8
+ "name": "uniapp-template-vue3-vite-tailwindcss",
9
9
  "version": "0.0.0",
10
10
  "dependencies": {
11
11
  "@dcloudio/uni-app": "3.0.0-4030620241128001",
@@ -23,6 +23,7 @@
23
23
  "@dcloudio/uni-mp-weixin": "3.0.0-4030620241128001",
24
24
  "@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
25
25
  "@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
26
+ "@dcloudio/uni-ui": "^1.5.11",
26
27
  "@iconify-json/mdi": "^1.2.3",
27
28
  "@iconify-json/ri": "^1.2.5",
28
29
  "@iconify/vue": "^5.0.0",
@@ -50,6 +51,8 @@
50
51
  "@eslint/js": "^9.31.0",
51
52
  "@tailwindcss/postcss": "^4.1.14",
52
53
  "@typescript-eslint/eslint-plugin": "^8.38.0",
54
+ "@uni-helper/uni-app-types": "^1.0.0-alpha.6",
55
+ "@uni-helper/uni-ui-types": "^1.0.0-alpha.6",
53
56
  "@vue/runtime-core": "^3.4.21",
54
57
  "@vue/tsconfig": "^0.7.0",
55
58
  "autoprefixer": "^10.4.21",
@@ -2801,6 +2804,12 @@
2801
2804
  "debug": "^4.3.3"
2802
2805
  }
2803
2806
  },
2807
+ "node_modules/@dcloudio/uni-ui": {
2808
+ "version": "1.5.11",
2809
+ "resolved": "https://registry.npmjs.org/@dcloudio/uni-ui/-/uni-ui-1.5.11.tgz",
2810
+ "integrity": "sha512-DBtk046ofmeFd82zRI7d89SoEwrAxYzUN3WVPm1DIBkpLPG5F5QDNkHMnZGu2wNrMEmGBjBpUh3vqEY1L3jaMw==",
2811
+ "license": "Apache-2.0"
2812
+ },
2804
2813
  "node_modules/@dcloudio/vite-plugin-uni": {
2805
2814
  "version": "3.0.0-4030620241128001",
2806
2815
  "resolved": "https://registry.npmjs.org/@dcloudio/vite-plugin-uni/-/vite-plugin-uni-3.0.0-4030620241128001.tgz",
@@ -5543,6 +5552,44 @@
5543
5552
  "url": "https://opencollective.com/eslint"
5544
5553
  }
5545
5554
  },
5555
+ "node_modules/@uni-helper/uni-app-types": {
5556
+ "version": "1.0.0-alpha.6",
5557
+ "resolved": "https://registry.npmjs.org/@uni-helper/uni-app-types/-/uni-app-types-1.0.0-alpha.6.tgz",
5558
+ "integrity": "sha512-t9AKDYBmDaz4IW0fgtBt25ubEzf7kyUeMlHaBaG5nyNGd6pVuDpYkABhsnNPDiZcaHAoN6SbX1SQQx5axDOWbA==",
5559
+ "dev": true,
5560
+ "license": "MIT",
5561
+ "engines": {
5562
+ "node": ">=14.18"
5563
+ },
5564
+ "funding": {
5565
+ "url": "https://github.com/ModyQyW/sponsors"
5566
+ },
5567
+ "peerDependencies": {
5568
+ "typescript": "^5.0.0",
5569
+ "vue": "^3.0.0"
5570
+ }
5571
+ },
5572
+ "node_modules/@uni-helper/uni-ui-types": {
5573
+ "version": "1.0.0-alpha.6",
5574
+ "resolved": "https://registry.npmjs.org/@uni-helper/uni-ui-types/-/uni-ui-types-1.0.0-alpha.6.tgz",
5575
+ "integrity": "sha512-2KuAup2M7rPVzpLaXhhnxCD/Cs5VQYiqzC9XNI/VZuA88+ApPmHzkwyS0THSHnz1VbDIGX/Ju69nj+mApfYKDw==",
5576
+ "dev": true,
5577
+ "license": "MIT",
5578
+ "dependencies": {
5579
+ "@uni-helper/uni-app-types": "1.0.0-alpha.6"
5580
+ },
5581
+ "engines": {
5582
+ "node": ">=14.18"
5583
+ },
5584
+ "funding": {
5585
+ "url": "https://github.com/ModyQyW/sponsors"
5586
+ },
5587
+ "peerDependencies": {
5588
+ "@uni-helper/uni-app-types": "1.0.0-alpha.6",
5589
+ "typescript": "^5.0.0",
5590
+ "vue": "^3.0.0"
5591
+ }
5592
+ },
5546
5593
  "node_modules/@volar/language-core": {
5547
5594
  "version": "1.11.1",
5548
5595
  "resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-1.11.1.tgz",
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "uni-preset-vue",
2
+ "name": "uniapp-template-vue3-vite-tailwindcss",
3
3
  "version": "0.0.0",
4
4
  "scripts": {
5
5
  "dev:custom": "uni -p",
@@ -50,6 +50,7 @@
50
50
  "@dcloudio/uni-mp-weixin": "3.0.0-4030620241128001",
51
51
  "@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
52
52
  "@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
53
+ "@dcloudio/uni-ui": "^1.5.11",
53
54
  "@iconify-json/mdi": "^1.2.3",
54
55
  "@iconify-json/ri": "^1.2.5",
55
56
  "@iconify/vue": "^5.0.0",
@@ -77,6 +78,8 @@
77
78
  "@eslint/js": "^9.31.0",
78
79
  "@tailwindcss/postcss": "^4.1.14",
79
80
  "@typescript-eslint/eslint-plugin": "^8.38.0",
81
+ "@uni-helper/uni-app-types": "^1.0.0-alpha.6",
82
+ "@uni-helper/uni-ui-types": "^1.0.0-alpha.6",
80
83
  "@vue/runtime-core": "^3.4.21",
81
84
  "@vue/tsconfig": "^0.7.0",
82
85
  "autoprefixer": "^10.4.21",
@@ -98,4 +101,4 @@
98
101
  "vite-plugin-eslint": "^1.8.1",
99
102
  "vue-tsc": "^1.0.24"
100
103
  }
101
- }
104
+ }
@@ -14,5 +14,4 @@ onHide(() => {
14
14
  /*每个页面公共css */
15
15
  @import '@/uni_modules/uview-plus/index.scss';
16
16
  @import './static/css/index.scss';
17
- @import './static/css/tailwind.css';
18
17
  </style>
@@ -11,6 +11,8 @@ addCollection(mdiIcon);
11
11
 
12
12
  const pinia = createPinia();
13
13
 
14
+ import './static/css/tailwind.css'
15
+
14
16
  export function createApp() {
15
17
  const app = createSSRApp(App);
16
18
  app.use(pinia);
@@ -3,8 +3,8 @@
3
3
  </script>
4
4
 
5
5
  <template>
6
- <view class="w-full h-[100vh] flex items-center justify-center">
7
- <text class="text-2xl font-bold">Hello!</text>
6
+ <view class="w-full h-[calc(100vh-88rpx)] !flex justify-center items-center">
7
+ <text>首页</text>
8
8
  </view>
9
9
  </template>
10
10
 
@@ -1,16 +1,23 @@
1
1
  {
2
+ "easycom": {
3
+ "autoscan": true,
4
+ "custom": {
5
+ "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
6
+ }
7
+ },
2
8
  "pages": [
3
9
  {
4
10
  "path": "pages/index/index",
5
11
  "style": {
6
- "navigationBarTitleText": "uni-app",
7
- "navigationStyle": "custom"
12
+ "navigationBarTitleText": "首页"
8
13
  }
9
14
  }
10
15
  ],
11
16
  "globalStyle": {
12
17
  "navigationBarTextStyle": "black",
13
18
  "navigationBarTitleText": "uni-app",
19
+ "navigationBarTitleSize": "18px",
20
+ "navigationBarTitleWeight": "bold",
14
21
  "navigationBarBackgroundColor": "#F8F8F8",
15
22
  "backgroundColor": "#F8F8F8"
16
23
  }
@@ -1,7 +1,5 @@
1
1
  * {
2
2
  box-sizing: border-box;
3
- margin: 0;
4
- padding: 0;
5
3
  }
6
4
 
7
5
  body {
@@ -11,4 +9,4 @@ body {
11
9
 
12
10
  ul {
13
11
  list-style: none;
14
- }
12
+ }
@@ -1 +1,2 @@
1
- @import "tailwindcss";
1
+ @import "tailwindcss/preflight";
2
+ @import "tailwindcss/utilities";
File without changes
@@ -1,237 +1,219 @@
1
1
  <template>
2
- <view
3
- class="u-icon"
4
- @tap="clickHandler"
5
- :class="['u-icon--' + labelPos]"
6
- >
7
- <image
8
- class="u-icon__img"
9
- v-if="isImg"
10
- :src="name"
11
- :mode="imgMode"
12
- :style="[imgStyle, addStyle(customStyle)]"
13
- ></image>
14
- <text
15
- v-else
16
- class="u-icon__icon"
17
- :class="uClasses"
18
- :style="[iconStyle, addStyle(customStyle)]"
19
- :hover-class="hoverClass"
20
- >{{icon}}</text>
2
+ <view class="u-icon" @tap="clickHandler" :class="['u-icon--' + labelPos]">
3
+ <image class="u-icon__img" v-if="isImg" :src="name" :mode="imgMode" :style="[imgStyle, addStyle(customStyle)]">
4
+ </image>
5
+ <text v-else class="u-icon__icon" :class="uClasses" :style="[iconStyle, addStyle(customStyle)]"
6
+ :hover-class="hoverClass">{{ icon }}</text>
21
7
  <!-- 这里进行空字符串判断,如果仅仅是v-if="label",可能会出现传递0的时候,结果也无法显示 -->
22
- <text
23
- v-if="label !== ''"
24
- class="u-icon__label"
25
- :style="{
8
+ <text v-if="label !== ''" class="u-icon__label" :style="{
26
9
  color: labelColor,
27
10
  fontSize: addUnit(labelSize),
28
11
  marginLeft: labelPos == 'right' ? addUnit(space) : 0,
29
12
  marginTop: labelPos == 'bottom' ? addUnit(space) : 0,
30
13
  marginRight: labelPos == 'left' ? addUnit(space) : 0,
31
14
  marginBottom: labelPos == 'top' ? addUnit(space) : 0,
32
- }"
33
- >{{ label }}</text>
15
+ }">{{ label }}</text>
34
16
  </view>
35
17
  </template>
36
18
 
37
19
  <script>
38
- // 引入图标名称,已经对应的unicode
39
- import icons from './icons';
40
- import { props } from './props';
41
- import config from '../../libs/config/config';
42
- import { mpMixin } from '../../libs/mixin/mpMixin';
43
- import { mixin } from '../../libs/mixin/mixin';
44
- import { addUnit, addStyle } from '../../libs/function/index';
45
- import fontUtil from './util';
46
- /**
47
- * icon 图标
48
- * @description 基于字体的图标集,包含了大多数常见场景的图标。
49
- * @tutorial https://ijry.github.io/uview-plus/components/icon.html
50
- * @property {String} name 图标名称,见示例图标集
51
- * @property {String} color 图标颜色,可接受主题色 (默认 color['u-content-color'] )
52
- * @property {String | Number} size 图标字体大小,单位px (默认 '16px' )
53
- * @property {Boolean} bold 是否显示粗体 (默认 false )
54
- * @property {String | Number} index 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
55
- * @property {String} hoverClass 图标按下去的样式类,用法同uni的view组件的hoverClass参数,详情见官网
56
- * @property {String} customPrefix 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'uicon' )
57
- * @property {String | Number} label 图标右侧的label文字
58
- * @property {String} labelPos label相对于图标的位置,只能right或bottom (默认 'right' )
59
- * @property {String | Number} labelSize label字体大小,单位px (默认 '15px' )
60
- * @property {String} labelColor 图标右侧的label文字颜色 ( 默认 color['u-content-color'] )
61
- * @property {String | Number} space label与图标的距离,单位px (默认 '3px' )
62
- * @property {String} imgMode 图片的mode
63
- * @property {String | Number} width 显示图片小图标时的宽度
64
- * @property {String | Number} height 显示图片小图标时的高度
65
- * @property {String | Number} top 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0 )
66
- * @property {Boolean} stop 是否阻止事件传播 (默认 false )
67
- * @property {Object} customStyle icon的样式,对象形式
68
- * @event {Function} click 点击图标时触发
69
- * @event {Function} touchstart 事件触摸时触发
70
- * @example <u-icon name="photo" color="#2979ff" size="28"></u-icon>
71
- */
72
- export default {
73
- name: 'u-icon',
74
- beforeCreate() {
75
- fontUtil.loadFont();
76
- },
77
- data() {
78
- return {
20
+ // 引入图标名称,已经对应的unicode
21
+ import icons from './icons';
22
+ import { props } from './props';
23
+ import config from '../../libs/config/config';
24
+ import { mpMixin } from '../../libs/mixin/mpMixin';
25
+ import { mixin } from '../../libs/mixin/mixin';
26
+ import { addUnit, addStyle } from '../../libs/function/index';
27
+ import fontUtil from './util';
28
+ /**
29
+ * icon 图标
30
+ * @description 基于字体的图标集,包含了大多数常见场景的图标。
31
+ * @tutorial https://ijry.github.io/uview-plus/components/icon.html
32
+ * @property {String} name 图标名称,见示例图标集
33
+ * @property {String} color 图标颜色,可接受主题色 (默认 color['u-content-color'] )
34
+ * @property {String | Number} size 图标字体大小,单位px (默认 '16px' )
35
+ * @property {Boolean} bold 是否显示粗体 (默认 false )
36
+ * @property {String | Number} index 点击图标的时候传递事件出去的index(用于区分点击了哪一个)
37
+ * @property {String} hoverClass 图标按下去的样式类,用法同uni的view组件的hoverClass参数,详情见官网
38
+ * @property {String} customPrefix 自定义扩展前缀,方便用户扩展自己的图标库 (默认 'uicon' )
39
+ * @property {String | Number} label 图标右侧的label文字
40
+ * @property {String} labelPos label相对于图标的位置,只能right或bottom (默认 'right' )
41
+ * @property {String | Number} labelSize label字体大小,单位px (默认 '15px' )
42
+ * @property {String} labelColor 图标右侧的label文字颜色 ( 默认 color['u-content-color'] )
43
+ * @property {String | Number} space label与图标的距离,单位px (默认 '3px' )
44
+ * @property {String} imgMode 图片的mode
45
+ * @property {String | Number} width 显示图片小图标时的宽度
46
+ * @property {String | Number} height 显示图片小图标时的高度
47
+ * @property {String | Number} top 图标在垂直方向上的定位 用于解决某些情况下,让图标垂直居中的用途 (默认 0 )
48
+ * @property {Boolean} stop 是否阻止事件传播 (默认 false )
49
+ * @property {Object} customStyle icon的样式,对象形式
50
+ * @event {Function} click 点击图标时触发
51
+ * @event {Function} touchstart 事件触摸时触发
52
+ * @example <u-icon name="photo" color="#2979ff" size="28"></u-icon>
53
+ */
54
+ export default {
55
+ name: 'u-icon',
56
+ beforeCreate() {
57
+ fontUtil.loadFont();
58
+ },
59
+ data() {
60
+ return {
61
+ }
62
+ },
63
+ emits: ['click'],
64
+ mixins: [mpMixin, mixin, props],
65
+ computed: {
66
+ uClasses() {
67
+ let classes = []
68
+ classes.push(this.customPrefix + '-' + this.name)
69
+ // uview-plus内置图标类名为u-iconfont
70
+ if (this.customPrefix == 'uicon') {
71
+ classes.push('u-iconfont')
72
+ } else {
73
+ // 不能缺少这一步,否则自定义图标会无效
74
+ classes.push(this.customPrefix)
79
75
  }
76
+ // 主题色,通过类配置
77
+ if (this.color && config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
78
+ // 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
79
+ // 故需将其拆成一个字符串的形式,通过空格隔开各个类名
80
+ //#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
81
+ classes = classes.join(' ')
82
+ //#endif
83
+ return classes
80
84
  },
81
- emits: ['click'],
82
- mixins: [mpMixin, mixin, props],
83
- computed: {
84
- uClasses() {
85
- let classes = []
86
- classes.push(this.customPrefix + '-' + this.name)
87
- // uview-plus内置图标类名为u-iconfont
88
- if (this.customPrefix == 'uicon') {
89
- classes.push('u-iconfont')
90
- } else {
91
- // 不能缺少这一步,否则自定义图标会无效
92
- classes.push(this.customPrefix)
93
- }
94
- // 主题色,通过类配置
95
- if (this.color && config.type.includes(this.color)) classes.push('u-icon__icon--' + this.color)
96
- // 阿里,头条,百度小程序通过数组绑定类名时,无法直接使用[a, b, c]的形式,否则无法识别
97
- // 故需将其拆成一个字符串的形式,通过空格隔开各个类名
98
- //#ifdef MP-ALIPAY || MP-TOUTIAO || MP-BAIDU
99
- classes = classes.join(' ')
100
- //#endif
101
- return classes
102
- },
103
- iconStyle() {
104
- let style = {}
105
- style = {
106
- fontSize: addUnit(this.size),
107
- lineHeight: addUnit(this.size),
108
- fontWeight: this.bold ? 'bold' : 'normal',
109
- // 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
110
- top: addUnit(this.top)
111
- }
112
- if (this.customPrefix !== 'uicon') {
113
- style.fontFamily = this.customPrefix
114
- }
115
- // 非主题色值时,才当作颜色值
116
- if (this.color && !config.type.includes(this.color)) style.color = this.color
117
-
118
- return style
119
- },
120
- // 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
121
- isImg() {
122
- return this.name.indexOf('/') !== -1
123
- },
124
- imgStyle() {
125
- let style = {}
126
- // 如果设置width和height属性,则优先使用,否则使用size属性
127
- style.width = this.width ? addUnit(this.width) : addUnit(this.size)
128
- style.height = this.height ? addUnit(this.height) : addUnit(this.size)
129
- return style
130
- },
131
- // 通过图标名,查找对应的图标
132
- icon() {
133
- // 使用自定义图标的时候页面上会把name属性也展示出来,所以在这里处理一下
134
- if (this.customPrefix !== "uicon") {
135
- return config.customIcons[this.name] || this.name;
136
- }
137
- // 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
138
- return icons['uicon-' + this.name] || this.name
85
+ iconStyle() {
86
+ let style = {}
87
+ style = {
88
+ fontSize: addUnit(this.size),
89
+ lineHeight: addUnit(this.size),
90
+ fontWeight: this.bold ? 'bold' : 'normal',
91
+ // 某些特殊情况需要设置一个到顶部的距离,才能更好的垂直居中
92
+ top: addUnit(this.top)
93
+ }
94
+ if (this.customPrefix !== 'uicon') {
95
+ style.fontFamily = this.customPrefix
139
96
  }
97
+ // 非主题色值时,才当作颜色值
98
+ if (this.color && !config.type.includes(this.color)) style.color = this.color
99
+
100
+ return style
101
+ },
102
+ // 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式
103
+ isImg() {
104
+ return this.name.indexOf('/') !== -1
105
+ },
106
+ imgStyle() {
107
+ let style = {}
108
+ // 如果设置width和height属性,则优先使用,否则使用size属性
109
+ style.width = this.width ? addUnit(this.width) : addUnit(this.size)
110
+ style.height = this.height ? addUnit(this.height) : addUnit(this.size)
111
+ return style
140
112
  },
141
- methods: {
142
- addStyle,
143
- addUnit,
144
- clickHandler(e) {
145
- this.$emit('click', this.index, e)
146
- // 是否阻止事件冒泡
147
- this.stop && this.preventEvent(e)
113
+ // 通过图标名,查找对应的图标
114
+ icon() {
115
+ // 使用自定义图标的时候页面上会把name属性也展示出来,所以在这里处理一下
116
+ if (this.customPrefix !== "uicon") {
117
+ return config.customIcons[this.name] || this.name;
148
118
  }
119
+ // 如果内置的图标中找不到对应的图标,就直接返回name值,因为用户可能传入的是unicode代码
120
+ return icons['uicon-' + this.name] || this.name
121
+ }
122
+ },
123
+ methods: {
124
+ addStyle,
125
+ addUnit,
126
+ clickHandler(e) {
127
+ this.$emit('click', this.index, e)
128
+ // 是否阻止事件冒泡
129
+ this.stop && this.preventEvent(e)
149
130
  }
150
131
  }
132
+ }
151
133
  </script>
152
134
 
153
135
  <style lang="scss" scoped>
136
+ // 变量定义
137
+ $u-icon-primary: $u-primary !default;
138
+ $u-icon-success: $u-success !default;
139
+ $u-icon-info: $u-info !default;
140
+ $u-icon-warning: $u-warning !default;
141
+ $u-icon-error: $u-error !default;
142
+ $u-icon-label-line-height: 1 !default;
143
+
144
+ /* #ifdef MP-QQ || MP-TOUTIAO || MP-BAIDU || MP-KUAISHOU || MP-XHS */
145
+ // 2025/04/09在App/微信/支付宝/鸿蒙元服务已改用uni.loadFontFace加载字体
146
+ @font-face {
147
+ font-family: 'uicon-iconfont';
148
+ src: url('./font_2225171_8kdcwk4po24.ttf') format('truetype');
149
+ }
150
+
151
+ /* #endif */
152
+
153
+ .u-icon {
154
+ /* #ifndef APP-NVUE */
155
+ display: flex;
156
+ /* #endif */
157
+ align-items: center;
154
158
 
155
- // 变量定义
156
- $u-icon-primary: $u-primary !default;
157
- $u-icon-success: $u-success !default;
158
- $u-icon-info: $u-info !default;
159
- $u-icon-warning: $u-warning !default;
160
- $u-icon-error: $u-error !default;
161
- $u-icon-label-line-height:1 !default;
162
-
163
- /* #ifdef MP-QQ || MP-TOUTIAO || MP-BAIDU || MP-KUAISHOU || MP-XHS */
164
- // 2025/04/09在App/微信/支付宝/鸿蒙元服务已改用uni.loadFontFace加载字体
165
- @font-face {
166
- font-family: 'uicon-iconfont';
167
- src: url('https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf') format('truetype');
159
+ &--left {
160
+ flex-direction: row-reverse;
161
+ align-items: center;
168
162
  }
169
- /* #endif */
170
163
 
171
- .u-icon {
172
- /* #ifndef APP-NVUE */
173
- display: flex;
174
- /* #endif */
164
+ &--right {
165
+ flex-direction: row;
175
166
  align-items: center;
167
+ }
176
168
 
177
- &--left {
178
- flex-direction: row-reverse;
179
- align-items: center;
180
- }
169
+ &--top {
170
+ flex-direction: column-reverse;
171
+ justify-content: center;
172
+ }
181
173
 
182
- &--right {
183
- flex-direction: row;
184
- align-items: center;
185
- }
174
+ &--bottom {
175
+ flex-direction: column;
176
+ justify-content: center;
177
+ }
186
178
 
187
- &--top {
188
- flex-direction: column-reverse;
189
- justify-content: center;
190
- }
179
+ &__icon {
180
+ font-family: uicon-iconfont;
181
+ position: relative;
182
+ @include flex;
183
+ align-items: center;
191
184
 
192
- &--bottom {
193
- flex-direction: column;
194
- justify-content: center;
185
+ &--primary {
186
+ color: $u-icon-primary;
195
187
  }
196
188
 
197
- &__icon {
198
- font-family: uicon-iconfont;
199
- position: relative;
200
- @include flex;
201
- align-items: center;
202
-
203
- &--primary {
204
- color: $u-icon-primary;
205
- }
206
-
207
- &--success {
208
- color: $u-icon-success;
209
- }
210
-
211
- &--error {
212
- color: $u-icon-error;
213
- }
214
-
215
- &--warning {
216
- color: $u-icon-warning;
217
- }
189
+ &--success {
190
+ color: $u-icon-success;
191
+ }
218
192
 
219
- &--info {
220
- color: $u-icon-info;
221
- }
193
+ &--error {
194
+ color: $u-icon-error;
222
195
  }
223
196
 
224
- &__img {
225
- /* #ifndef APP-NVUE */
226
- height: auto;
227
- will-change: transform;
228
- /* #endif */
197
+ &--warning {
198
+ color: $u-icon-warning;
229
199
  }
230
200
 
231
- &__label {
232
- /* #ifndef APP-NVUE */
233
- line-height: $u-icon-label-line-height;
234
- /* #endif */
201
+ &--info {
202
+ color: $u-icon-info;
235
203
  }
236
204
  }
205
+
206
+ &__img {
207
+ /* #ifndef APP-NVUE */
208
+ height: auto;
209
+ will-change: transform;
210
+ /* #endif */
211
+ }
212
+
213
+ &__label {
214
+ /* #ifndef APP-NVUE */
215
+ line-height: $u-icon-label-line-height;
216
+ /* #endif */
217
+ }
218
+ }
237
219
  </style>
@@ -1,75 +1,90 @@
1
1
  import config from '../../libs/config/config';
2
2
  // 定义高阶函数
3
3
  function once(fn) {
4
- let called = false;
5
- let result;
4
+ let called = false;
5
+ let result;
6
6
 
7
- return function(...args) {
8
- if (!called) {
9
- result = fn.apply(this, args);
10
- called = true;
11
- }
12
- return result;
13
- };
7
+ return function (...args) {
8
+ if (!called) {
9
+ result = fn.apply(this, args);
10
+ called = true;
11
+ }
12
+ return result;
13
+ };
14
14
  }
15
15
 
16
16
  // 使用高阶函数
17
17
  const loadFont = once(() => {
18
- // console.log('这个函数只能执行一次');
19
- // #ifdef APP-NVUE
20
- // nvue通过weex的dom模块引入字体,相关文档地址如下:
21
- // https://weex.apache.org/zh/docs/modules/dom.html#addrule
22
- const domModule = weex.requireModule('dom');
23
- domModule.addRule('fontFace', {
24
- 'fontFamily': "uicon-iconfont",
25
- 'src': `url('${config.iconUrl}')`
26
- });
27
- if (config.customIcon.family) {
28
- domModule.addRule('fontFace', {
29
- 'fontFamily': config.customIcon.family,
30
- 'src': `url('${config.customIcon.url}')`
31
- });
32
- }
33
- // #endif
34
- // #ifdef APP || H5 || MP-WEIXIN || MP-ALIPAY
35
- uni.loadFontFace({
36
- global: true, // 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
37
- family: 'uicon-iconfont',
38
- source: 'url("' + config.iconUrl + '")',
39
- success() {
40
- // console.log('内置字体图标加载成功');
41
- },
42
- fail() {
43
- // console.error('内置字体图标加载出错');
44
- }
45
- });
46
- if (config.customIcon.family) {
47
- uni.loadFontFace({
48
- global: true, // 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
49
- family: config.customIcon.family,
50
- source: 'url("' + config.customIcon.url + '")',
51
- success() {
52
- // console.log('扩展字体图标加载成功');
53
- },
54
- fail() {
55
- // console.error('扩展字体图标加载出错');
56
- }
57
- });
58
- }
59
- // #endif
60
- // #ifdef APP-NVUE
61
- if (this.customFontFamily) {
62
- domModule.addRule('fontFace', {
63
- 'fontFamily': `${this.customPrefix}-${this.customFontFamily}`,
64
- 'src': `url('${this.customFontUrl}')`
65
- })
66
- }
67
- // #endif
68
- return true;
18
+ // console.log('这个函数只能执行一次');
19
+ // #ifdef APP-NVUE
20
+ // nvue通过weex的dom模块引入字体,相关文档地址如下:
21
+ // https://weex.apache.org/zh/docs/modules/dom.html#addrule
22
+ const domModule = weex.requireModule('dom');
23
+ domModule.addRule('fontFace', {
24
+ 'fontFamily': "uicon-iconfont",
25
+ 'src': `url('${config.iconUrl}')`
26
+ });
27
+ if (config.customIcon.family) {
28
+ domModule.addRule('fontFace', {
29
+ 'fontFamily': config.customIcon.family,
30
+ 'src': `url('${config.customIcon.url}')`
31
+ });
32
+ }
33
+ // #endif
34
+ // #ifdef APP || H5 || MP-WEIXIN || MP-ALIPAY
35
+ console.log('📦 开始加载 uView Plus 字体:', config.iconUrl);
36
+ uni.loadFontFace({
37
+ global: true, // 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
38
+ family: 'uicon-iconfont',
39
+ source: 'url("' + config.iconUrl + '")',
40
+ success() {
41
+ console.log('✅ uView Plus 字体加载成功:', config.iconUrl);
42
+ },
43
+ fail(err) {
44
+ console.error('❌ uView Plus 字体加载失败:', config.iconUrl, err);
45
+ // 如果主路径失败,尝试备用路径
46
+ const fallbackUrl = 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf';
47
+ console.log('🔄 尝试备用字体路径:', fallbackUrl);
48
+ uni.loadFontFace({
49
+ global: true,
50
+ family: 'uicon-iconfont',
51
+ source: 'url("' + fallbackUrl + '")',
52
+ success() {
53
+ console.log('✅ 备用字体加载成功:', fallbackUrl);
54
+ },
55
+ fail(fallbackErr) {
56
+ console.error('❌ 备用字体也加载失败:', fallbackUrl, fallbackErr);
57
+ }
58
+ });
59
+ }
60
+ });
61
+ if (config.customIcon.family) {
62
+ uni.loadFontFace({
63
+ global: true, // 是否全局生效。微信小程序 '2.10.0'起支持全局生效,需在 app.vue 中调用。
64
+ family: config.customIcon.family,
65
+ source: 'url("' + config.customIcon.url + '")',
66
+ success() {
67
+ // console.log('扩展字体图标加载成功');
68
+ },
69
+ fail() {
70
+ // console.error('扩展字体图标加载出错');
71
+ }
72
+ });
73
+ }
74
+ // #endif
75
+ // #ifdef APP-NVUE
76
+ if (this.customFontFamily) {
77
+ domModule.addRule('fontFace', {
78
+ 'fontFamily': `${this.customPrefix}-${this.customFontFamily}`,
79
+ 'src': `url('${this.customFontUrl}')`
80
+ })
81
+ }
82
+ // #endif
83
+ return true;
69
84
  });
70
85
 
71
86
  let fontUtil = {
72
- loadFont
87
+ loadFont
73
88
  }
74
89
 
75
90
  export default fontUtil
@@ -6,45 +6,45 @@ if (process.env.NODE_ENV === 'development') {
6
6
  }
7
7
 
8
8
  export default {
9
- v: version,
10
- version,
11
- // 主题名称
12
- type: [
13
- 'primary',
14
- 'success',
15
- 'info',
16
- 'error',
17
- 'warning'
18
- ],
19
- // 颜色部分,本来可以通过scss的:export导出供js使用,但是奈何nvue不支持
20
- color: {
21
- 'u-primary': '#2979ff',
22
- 'u-warning': '#ff9900',
23
- 'u-success': '#19be6b',
24
- 'u-error': '#fa3534',
25
- 'u-info': '#909399',
26
- 'u-main-color': '#303133',
27
- 'u-content-color': '#606266',
28
- 'u-tips-color': '#909399',
29
- 'u-light-color': '#c0c4cc',
30
- 'up-primary': '#2979ff',
31
- 'up-warning': '#ff9900',
32
- 'up-success': '#19be6b',
33
- 'up-error': '#fa3534',
34
- 'up-info': '#909399',
35
- 'up-main-color': '#303133',
36
- 'up-content-color': '#606266',
37
- 'up-tips-color': '#909399',
38
- 'up-light-color': '#c0c4cc'
39
- },
40
- // 字体图标地址
41
- iconUrl: 'https://at.alicdn.com/t/font_2225171_8kdcwk4po24.ttf',
42
- // 自定义图标
43
- customIcon: {
44
- family: '',
45
- url: ''
46
- },
47
- customIcons: {}, // 自定义图标与unicode对应关系
9
+ v: version,
10
+ version,
11
+ // 主题名称
12
+ type: [
13
+ 'primary',
14
+ 'success',
15
+ 'info',
16
+ 'error',
17
+ 'warning'
18
+ ],
19
+ // 颜色部分,本来可以通过scss的:export导出供js使用,但是奈何nvue不支持
20
+ color: {
21
+ 'u-primary': '#2979ff',
22
+ 'u-warning': '#ff9900',
23
+ 'u-success': '#19be6b',
24
+ 'u-error': '#fa3534',
25
+ 'u-info': '#909399',
26
+ 'u-main-color': '#303133',
27
+ 'u-content-color': '#606266',
28
+ 'u-tips-color': '#909399',
29
+ 'u-light-color': '#c0c4cc',
30
+ 'up-primary': '#2979ff',
31
+ 'up-warning': '#ff9900',
32
+ 'up-success': '#19be6b',
33
+ 'up-error': '#fa3534',
34
+ 'up-info': '#909399',
35
+ 'up-main-color': '#303133',
36
+ 'up-content-color': '#606266',
37
+ 'up-tips-color': '#909399',
38
+ 'up-light-color': '#c0c4cc'
39
+ },
40
+ // 字体图标地址
41
+ iconUrl: '/static/font_2225171_8kdcwk4po24.ttf',
42
+ // 自定义图标
43
+ customIcon: {
44
+ family: '',
45
+ url: ''
46
+ },
47
+ customIcons: {}, // 自定义图标与unicode对应关系
48
48
  // 默认单位,可以通过配置为rpx,那么在用于传入组件大小参数为数值时,就默认为rpx
49
49
  unit: 'px',
50
50
  // 拦截器
@@ -1,3 +1,17 @@
1
- export const request = () => {
2
-
1
+ export const request = <T>(config: UniApp.RequestOptions): Promise<T> => {
2
+ return new Promise((resolve, reject) => {
3
+ uni.request({
4
+ ...config,
5
+ success: (res) => {
6
+ if (res.statusCode === 200) {
7
+ resolve(res.data as T)
8
+ } else {
9
+ reject(res)
10
+ }
11
+ },
12
+ fail: (err) => {
13
+ reject(err)
14
+ }
15
+ })
16
+ })
3
17
  }
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "extends": "@vue/tsconfig/tsconfig.json",
3
3
  "compilerOptions": {
4
+ "moduleResolution": "bundler",
4
5
  "sourceMap": true,
5
6
  "baseUrl": ".",
6
7
  "paths": {
@@ -13,14 +14,23 @@
13
14
  "dom"
14
15
  ],
15
16
  "types": [
16
- "@dcloudio/types"
17
+ "vite/client",
18
+ "@dcloudio/types",
19
+ "@uni-helper/uni-app-types",
20
+ "@uni-helper/uni-ui-types"
17
21
  ],
18
22
  "verbatimModuleSyntax": true,
19
23
  },
24
+ "vueCompilerOptions": {
25
+ "plugins": [
26
+ "@uni-helper/uni-app-types/volar-plugin"
27
+ ]
28
+ },
20
29
  "include": [
21
30
  "src/**/*.ts",
22
31
  "src/**/*.d.ts",
23
32
  "src/**/*.tsx",
24
- "src/**/*.vue"
33
+ "src/**/*.vue",
34
+ "*.d.ts"
25
35
  ]
26
36
  }