create-uniapps 1.0.0 → 1.0.2

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/index.mjs CHANGED
@@ -121,11 +121,7 @@ function printCompletion(targetDir, installDeps) {
121
121
  }
122
122
 
123
123
  console.log(chalk.dim(` # 启动开发服务器`));
124
- console.log(` npm run dev`);
125
- console.log();
126
- console.log(chalk.dim(` # 构建生产版本`));
127
- console.log(` npm run build`);
128
- console.log();
124
+ console.log(` npm run dev:h5`);
129
125
  }
130
126
 
131
127
  // 主函数
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-uniapps",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "UniApps template",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,190 @@
1
+ # 🌈 uni-preset-vue 模板说明文档
2
+
3
+ 一个基于 **Vue3 + TypeScript + Vite + Pinia + TailwindCSS** 的 `uni-app` 模板,内置多端开发环境配置,支持一键运行微信小程序、H5、App 及各类小程序平台。
4
+ 本模板旨在快速搭建跨端项目,统一前端开发规范,提高开发效率。
5
+
6
+ ---
7
+
8
+ ## 📦 技术栈
9
+
10
+ | 技术 | 说明 |
11
+ | ---------------------------------- | ---------------------- |
12
+ | **Vue 3** | 渐进式前端框架 |
13
+ | **TypeScript** | 静态类型检查 |
14
+ | **Vite** | 高性能构建工具 |
15
+ | **Pinia** | 轻量级状态管理 |
16
+ | **TailwindCSS** | 原子化 CSS 框架 |
17
+ | **VueUse** | Vue3 实用工具库 |
18
+ | **Iconify** | 图标库整合方案 |
19
+ | **Day.js** | 日期处理库 |
20
+ | **Crypto-js / js-md5 / js-base64** | 数据加密与编码工具 |
21
+ | **ESLint + Prettier** | 统一代码风格与语法检查 |
22
+
23
+ ---
24
+
25
+ ## 🚀 快速开始
26
+
27
+ ### 1️⃣ 安装依赖
28
+
29
+ ```bash
30
+ pnpm install
31
+ # 或
32
+ npm install
33
+ # 或
34
+ yarn
35
+ ```
36
+
37
+ ### 2️⃣ 启动开发
38
+
39
+ 可根据需要启动不同端的调试模式:
40
+
41
+ | 命令 | 平台说明 |
42
+ | ------------------------------ | ------------------- |
43
+ | `npm run dev:h5` | 运行 H5 页面 |
44
+ | `npm run dev:mp-weixin` | 运行微信小程序 |
45
+ | `npm run dev:mp-alipay` | 运行支付宝小程序 |
46
+ | `npm run dev:mp-toutiao` | 运行字节跳动小程序 |
47
+ | `npm run dev:mp-baidu` | 运行百度小程序 |
48
+ | `npm run dev:mp-qq` | 运行 QQ 小程序 |
49
+ | `npm run dev:mp-xhs` | 运行小红书小程序 |
50
+ | `npm run dev:quickapp-webview` | 运行快应用 |
51
+ | `npm run dev:h5:ssr` | 运行 SSR 模式(H5) |
52
+
53
+ ---
54
+
55
+ ### 3️⃣ 打包构建
56
+
57
+ | 命令 | 说明 |
58
+ | -------------------------------- | ---------------- |
59
+ | `npm run build:h5` | 构建 H5 版本 |
60
+ | `npm run build:mp-weixin` | 构建微信小程序 |
61
+ | `npm run build:mp-alipay` | 构建支付宝小程序 |
62
+ | `npm run build:mp-toutiao` | 构建字节小程序 |
63
+ | `npm run build:h5:ssr` | 构建 SSR H5 |
64
+ | `npm run build:quickapp-webview` | 构建快应用 |
65
+
66
+ ---
67
+
68
+ ## 🧩 项目结构
69
+
70
+ ```
71
+ uni-preset-vue/
72
+ ├── src/
73
+ │ ├── pages/ # 页面目录
74
+ │ ├── components/ # 公共组件
75
+ │ ├── store/ # Pinia 状态管理
76
+ │ ├── utils/ # 工具函数与封装
77
+ │ ├── locales/ # i18n 国际化配置
78
+ │ ├── styles/ # 全局样式与 Tailwind 配置
79
+ │ └── main.ts # 入口文件
80
+
81
+ ├── uni_modules/ # uni-app 模块目录
82
+ ├── static/ # 静态资源
83
+ ├── package.json
84
+ ├── vite.config.ts
85
+ ├── tsconfig.json
86
+ └── README.md
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 🧠 开发规范
92
+
93
+ ### 代码规范
94
+
95
+ - 使用 **TypeScript** 编写逻辑。
96
+
97
+ - 使用 **ESLint + Prettier + Tailwind** 进行自动格式化。
98
+
99
+ - 提交前执行:
100
+
101
+ ```bash
102
+ npm run type-check
103
+ ```
104
+
105
+ 确保类型检查通过。
106
+
107
+ ### 目录规范
108
+
109
+ - 页面统一放在 `src/pages/`
110
+ - 公共组件放在 `src/components/`
111
+ - 全局状态放在 `src/store/`
112
+ - 工具函数放在 `src/utils/`
113
+ - 样式配置统一放在 `src/styles/`
114
+
115
+ ---
116
+
117
+ ## 🧰 常用依赖说明
118
+
119
+ | 依赖 | 用途 |
120
+ | ------------------------------------ | -------------- |
121
+ | `@vueuse/core` | 常用组合式函数 |
122
+ | `dayjs` | 时间格式化 |
123
+ | `crypto-js` / `js-md5` / `js-base64` | 数据加密与签名 |
124
+ | `qs` | 请求参数序列化 |
125
+ | `@iconify/vue` | 图标组件 |
126
+ | `pinia` | 全局状态管理 |
127
+ | `vue-i18n` | 多语言支持 |
128
+
129
+ ---
130
+
131
+ ## 🧪 检查与优化
132
+
133
+ | 命令 | 功能 |
134
+ | -------------------- | --------------------------- |
135
+ | `npm run type-check` | 类型检查 |
136
+ | `npm run lint` | 语法检查 |
137
+ | `npm run format` | 自动格式化(结合 Prettier) |
138
+
139
+ ---
140
+
141
+ ## 🌍 支持平台
142
+
143
+ | 平台 | 是否支持 |
144
+ | --------------------- | -------- |
145
+ | H5 | ✅ |
146
+ | 微信小程序 | ✅ |
147
+ | 支付宝小程序 | ✅ |
148
+ | 抖音小程序 | ✅ |
149
+ | 百度小程序 | ✅ |
150
+ | QQ 小程序 | ✅ |
151
+ | 快应用 | ✅ |
152
+ | HarmonyOS (鸿蒙 NEXT) | ✅ |
153
+
154
+ ---
155
+
156
+ ## 💡 开发建议
157
+
158
+ 1. 推荐使用 **VSCode** 搭配以下插件:
159
+ - 🌟 `Volar`(Vue 3 支持)
160
+ - 🌟 `ESLint`
161
+ - 🌟 `Tailwind CSS IntelliSense`
162
+ - 🌟 `Iconify IntelliSense`
163
+
164
+ 2. 若需自定义端平台启动,请修改 `package.json` 中的 `scripts` 命令。
165
+
166
+ 3. 统一风格建议使用 `prettier-plugin-tailwindcss` 自动调整类名顺序。
167
+
168
+ ---
169
+
170
+ ## 🧾 License
171
+
172
+ 本项目模板仅供学习与快速开发使用。
173
+ 如需商用或二次封装,请保留原作者说明或在适当位置注明出处。
174
+
175
+ ---
176
+
177
+ ## 👨‍💻 作者信息
178
+
179
+ - 作者:josef
180
+ - 模板名称:`uni-preset-vue`
181
+ - 创建时间:2025年
182
+ - 版本:v1.0.0
183
+
184
+ ---
185
+
186
+ ## 📅 更新日志
187
+
188
+ | 日期 | 版本 | 内容 |
189
+ | ---------- | ------ | -------------- |
190
+ | 2025-10-13 | v1.0.0 | 初始化项目模板 |
@@ -3,7 +3,9 @@
3
3
  </script>
4
4
 
5
5
  <template>
6
- <view class="w-full h-[100vh]">首页</view>
6
+ <view class="w-full h-[100vh] flex items-center justify-center">
7
+ <text class="text-2xl font-bold">Hello!</text>
8
+ </view>
7
9
  </template>
8
10
 
9
11
  <style lang='scss' scoped></style>
@@ -6,12 +6,6 @@
6
6
  "navigationBarTitleText": "uni-app",
7
7
  "navigationStyle": "custom"
8
8
  }
9
- },
10
- {
11
- "path": "pages/equipmentFaultReport/index",
12
- "style": {
13
- "navigationBarTitleText": "设备故障报修"
14
- }
15
9
  }
16
10
  ],
17
11
  "globalStyle": {
@@ -59,11 +59,11 @@
59
59
 
60
60
  <script>
61
61
  import { props } from './props.js';
62
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
63
- import { mixin } from '../../libs/mixin/mixin.js';
62
+ import { mpMixin } from '../../libs/mixin/mpMixin';
63
+ import { mixin } from '../../libs/mixin/mixin';
64
64
  import { nextTick } from 'vue';
65
65
  import { guid, sleep, error } from '../../libs/function/index';
66
- import test from '../../libs/function/test.js';
66
+ import test from '../../libs/function/test';
67
67
  // #ifdef APP-NVUE
68
68
  const animation = uni.requireNativePlugin('animation')
69
69
  const dom = uni.requireNativePlugin('dom')
@@ -6,11 +6,11 @@
6
6
 
7
7
  <script>
8
8
  import { props } from "./props.js";
9
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
10
- import { mixin } from '../../libs/mixin/mixin.js';
11
- import Schema from "../../libs/util/async-validator.js";
9
+ import { mpMixin } from '../../libs/mixin/mpMixin';
10
+ import { mixin } from '../../libs/mixin/mixin';
11
+ import Schema from "../../libs/util/async-validator";
12
12
  import { toast, getProperty, setProperty, deepClone, error } from '../../libs/function/index';
13
- import test from '../../libs/function/test.js';
13
+ import test from '../../libs/function/test';
14
14
  // 去除警告信息
15
15
  Schema.warning = function() {};
16
16
  /**
@@ -78,9 +78,9 @@
78
78
 
79
79
  <script>
80
80
  import { props } from "./props.js";
81
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
82
- import { mixin } from '../../libs/mixin/mixin.js';
83
- import { debounce } from '../../libs/function/debounce.js';
81
+ import { mpMixin } from '../../libs/mixin/mpMixin';
82
+ import { mixin } from '../../libs/mixin/mixin';
83
+ import { debounce } from '../../libs/function/debounce';
84
84
  import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '../../libs/function/index';
85
85
  /**
86
86
  * Input 输入框
@@ -9,8 +9,8 @@
9
9
 
10
10
  <script>
11
11
  import { props } from "./props.js";
12
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
13
- import { mixin } from '../../libs/mixin/mixin.js';
12
+ import { mpMixin } from '../../libs/mixin/mpMixin';
13
+ import { mixin } from '../../libs/mixin/mixin';
14
14
  import { addStyle, deepMerge, addUnit, getWindowInfo } from '../../libs/function/index';
15
15
  /**
16
16
  * SafeBottom 底部安全区
@@ -55,8 +55,8 @@ const dom = uni.requireNativePlugin("dom");
55
55
  const animation = uni.requireNativePlugin("animation");
56
56
  // #endif
57
57
  import { props } from "./props.js";
58
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
59
- import { mixin } from '../../libs/mixin/mixin.js';
58
+ import { mpMixin } from '../../libs/mixin/mpMixin';
59
+ import { mixin } from '../../libs/mixin/mixin';
60
60
  import { addStyle, addUnit, sleep } from '../../libs/function/index';
61
61
  /**
62
62
  * Subsection 分段器
@@ -93,10 +93,10 @@
93
93
  </template>
94
94
  <script>
95
95
  import { props } from './props.js';
96
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
97
- import { mixin } from '../../libs/mixin/mixin.js';
96
+ import { mpMixin } from '../../libs/mixin/mpMixin';
97
+ import { mixin } from '../../libs/mixin/mixin';
98
98
  import { addUnit, addStyle, error } from '../../libs/function/index';
99
- import test from '../../libs/function/test.js';
99
+ import test from '../../libs/function/test';
100
100
  /**
101
101
  * Swiper 轮播图
102
102
  * @description 该组件一般用于导航轮播,广告展示等场景,可开箱即用,
@@ -44,8 +44,8 @@
44
44
 
45
45
  <script>
46
46
  import { props } from "./props.js";
47
- import { mpMixin } from '../../libs/mixin/mpMixin.js';
48
- import { mixin } from '../../libs/mixin/mixin.js';
47
+ import { mpMixin } from '../../libs/mixin/mpMixin';
48
+ import { mixin } from '../../libs/mixin/mixin';
49
49
  import { addStyle, addUnit, deepMerge, formValidate, os } from '../../libs/function/index';
50
50
  /**
51
51
  * Textarea 文本域
@@ -1,11 +0,0 @@
1
- {
2
- "plugins": [
3
- "prettier-plugin-tailwindcss"
4
- ],
5
- "vueIndentScriptAndStyle": false,
6
- "printWidth": 120,
7
- "singleQuote": true,
8
- "semi": true,
9
- "tabWidth": 4,
10
- "htmlWhitespaceSensitivity": "ignore"
11
- }