gwell-dialog 0.1.8 → 3.0.0

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/.eslintrc.js CHANGED
@@ -3,9 +3,11 @@ module.exports = {
3
3
  env: {
4
4
  node: true
5
5
  },
6
- extends: ['plugin:vue/essential','eslint:recommended', '@vue/prettier', 'plugin:prettier/recommended'],
6
+ extends: ['plugin:vue/vue3-essential', 'eslint:recommended', '@vue/prettier', 'plugin:prettier/recommended'],
7
+ parser: 'vue-eslint-parser',
7
8
  parserOptions: {
8
- parser: 'babel-eslint'
9
+ parser: '@babel/eslint-parser',
10
+ requireConfigFile: false
9
11
  },
10
12
  // 0是off关闭,1是warning警告,2是error报错
11
13
  rules: {
package/README.md CHANGED
@@ -1,233 +1,313 @@
1
- <!--
2
- * @Author: lengyihan
3
- * @Date: 2023-11-17 18:05:01
4
- * @LastEditors: lengyihan
5
- * @LastEditTime: 2023-12-13 15:51:04
6
- * @Description:
7
- * @FilePath: \gwell-dialog\README.md
8
- -->
9
-
10
- # gwell-dialog
11
-
12
- ## Project setup
13
-
14
- ```
15
- yarn install
16
- ```
17
-
18
- ### Compiles and hot-reloads for development
19
-
20
- ```
21
- yarn serve
22
- ```
23
-
24
- ### Compiles and minifies for production
25
-
26
- ```
27
- yarn build
28
- ```
29
-
30
- ### Lints and fixes files
31
-
32
- ```
33
- yarn lint
34
- ```
35
-
36
- ### Customize configuration
37
-
38
- See [Configuration Reference](https://cli.vuejs.org/config/).
39
-
40
- ### 使用场景
41
-
42
- 弹窗组件的封装可以提高代码的复用性和可维护性,使开发者能够更加方便地在不同的场景中使用和管理弹窗,根据弹窗组件规范设计图,通过封装,可以统一弹窗的样式和行为,并提供简洁的接口供其他组件或页面调用,这样,开发者可以更加专注于业务逻辑的实现,而无需重复编写弹窗的代码。弹窗组件中设有默认的头部、内容区和尾部,这三部分分别可使用插槽自定义内容,弹窗内设有默认头部关闭按钮、取消和确定按钮,底部关闭按钮等。
43
-
44
- ### 目录结构
45
-
46
- ```
47
- ├─.env.development
48
- ├─.env.production
49
- ├─.eslintignore
50
- ├─.eslintrc.js
51
- ├─.gitignore
52
- ├─.npmignore
53
- ├─.prettierignore
54
- ├─.prettierrc
55
- ├─.yarnignore
56
- ├─babel.config.js
57
- ├─examples ------------------------- // 示例
58
- │ ├─App.vue ------------------------ // 入口文件
59
- │ ├─assets
60
- │ │ ├─css
61
- │ │ │ └─style.scss
62
- │ │ └─images
63
- │ │  ├─icon_bottomClose.png
64
- │ │  └─icon_close.png
65
- │ ├─main.js ------------------------ // 全局注册文件
66
- │ └─views
67
- │  └─HomeView.vue ----------------- // 组件引用示例
68
- ├─jsconfig.json
69
- ├─lib
70
- │ ├─demo.html
71
- │ ├─gwell-dialog.common.js
72
- │ ├─gwell-dialog.common.js.map
73
- │ ├─gwell-dialog.css
74
- │ ├─gwell-dialog.umd.js
75
- │ ├─gwell-dialog.umd.js.map
76
- │ ├─gwell-dialog.umd.min.js
77
- │ └─gwell-dialog.umd.min.js.map
78
- ├─package.json
79
- ├─packages
80
- │ ├─dialog
81
- │ │ ├─index.js --------------------- // 导出弹窗组件
82
- │ │ └─main.vue --------------------- // 弹窗组件开发
83
- │ └─index.js ----------------------- // 整合并导出所有组件,实现组件的全局注册
84
- ├─postcss.config.js ---------------- // 屏幕适配
85
- ├─public
86
- │ ├─favicon.ico
87
- │ └─index.html
88
- ├─README.md
89
- ├─vue.config.js -------------------- // 配置入口文件
90
- └─yarn.lock
91
- ```
92
-
93
- ### 可传参数
94
-
95
- ```json
96
- {
97
- showDialog: Boolean, //是否显示弹窗
98
- title: String, //弹窗标题
99
- closeOnClickOverlay: {
100
- //点击弹窗外部可以关闭弹窗
101
- type: Boolean,
102
- default: true
103
- },
104
- className: {
105
- //自定义内容区域类名
106
- type: String,
107
- default: '' // centered:居中, veryBottom:最底部弹窗,bottomed:底部, special:特殊类型
108
- },
109
- buttons: {
110
- //自定义按钮
111
- type: Array,
112
- default: () => [
113
- //如果不传按钮则默认显示确定和关闭按钮
114
- // {
115
- // label: '', //标题,可以是html类型
116
- // action: Function, //方法
117
- // className: '', //自定义样式 cancelBottom:最底部取消按钮,red:红色按钮,custom:自定义按钮
118
- // style: {}
119
- // }
120
- ]
121
- },
122
- removeDefaultBtn: {
123
- type: Array, //传入默认按钮defaultBtn的type值就会删除对应的默认按钮,例如:['confirm']
124
- default: () => []
125
- },
126
- isShowDefaultBtn: {
127
- //是否显示默认按钮
128
- type: Boolean,
129
- default: true
130
- },
131
- cancelButtonText: String, //取消按钮文案
132
- confirmButtonText: String, //确认按钮文案
133
- cancelButtonColor: String, //取消按钮颜色
134
- confirmButtonColor: String, //确认按钮颜色
135
- isShowCloseBtn: {
136
- //是否显示顶部关闭按钮
137
- type: Boolean,
138
- default: false
139
- },
140
- isShowCloseBottomBtn: {
141
- //是否显示底部关闭按钮
142
- type: Boolean,
143
- default: false
144
- },
145
- overlay: {
146
- //是否展示遮罩层
147
- type: Boolean,
148
- default: true
149
- },
150
- overlayClass: String, //自定义遮罩层类名
151
- overlayStyle: {
152
- //自定义遮罩层样式
153
- type: Object,
154
- default: () => {}
155
- },
156
- lockScroll: {
157
- //锁定背景滚动
158
- type: Boolean,
159
- default: true
160
- },
161
- beforeClose: {
162
- //关闭前的回调函数
163
- type: Function,
164
- default: null
165
- },
166
- transition: {
167
- //动画类名
168
- type: String,
169
- default: 'fade'
170
- }
171
- }
172
- ```
173
-
174
- ### 使用教程
175
-
176
- 1、第一步安装:
177
-
178
- ```shell
179
- npm install gwell-dialog
180
- ```
181
-
182
-
183
-
184
- ```shell
185
- yarn add gwell-dialog
186
- ```
187
-
188
- 2、第二步注册组件
189
- `import GwellDialog from 'gwell-dialog';`
190
- `import 'gwell-dialog/lib/gwell-dialog.css';`
191
- `Vue.use(GwellDialog);`
192
- 3、第三步使用
193
- `<GwellDialog :showDialog.sync="showDialog"></GwellDialog>`
194
-
195
- ### 配置发布
196
-
197
- 1、在 package.json 文件的 scripts 中配置 lib 编译 组件库命令
198
- 主要需要四个参数:
199
-
200
- 1. target: 默认为构建应用,改为 lib 即可启用构建库模式
201
- 2. name: 输出文件名
202
- 3. dest: 输出目录,默认为 dist,这里我们改为** lib**
203
- 4. entry: 入口文件路径,默认为 src/App.vue,这里改为 packages/index.js
204
- 例如:"lib": "vue-cli-service build --target lib --name gwell-dialog --dest lib packages/index.js"
205
- 2、然后 执行编译命令
206
-
207
- ```shell
208
- npm run lib
209
- ```
210
-
211
- 3、在 npm 官网注册后登录 npm
212
-
213
- ```shell
214
- npm login
215
- ```
216
-
217
- 4、如果以前改过 npm 的镜像地址,比如使用了淘宝镜像,就先改回来
218
-
219
- ```shell
220
- npm config set registry http://registry.npmjs.org
221
- ```
222
-
223
- 5、发布
224
-
225
- ```shell
226
- npm publish
227
- ```
228
-
229
- 6、修改 npm
230
-
231
- ```shell
232
- npm version patch
233
- ```
1
+ <!--
2
+ * @Author: lengyihan
3
+ * @Date: 2023-11-17 18:05:01
4
+ * @LastEditors: lengyihan
5
+ * @LastEditTime: 2026-09-07 17:12:48
6
+ * @Description:
7
+ * @FilePath: \gwell-dialog\README.md
8
+ -->
9
+
10
+ # gwell-dialog
11
+
12
+ ## Project setup
13
+
14
+ ```
15
+ yarn install
16
+ ```
17
+
18
+ ### Compiles and hot-reloads for development
19
+
20
+ ```
21
+ yarn serve
22
+ ```
23
+
24
+ ### Compiles and minifies for production
25
+
26
+ ```
27
+ yarn build
28
+ ```
29
+
30
+ ### Lints and fixes files
31
+
32
+ ```
33
+ yarn lint
34
+ ```
35
+
36
+ ### Customize configuration
37
+
38
+ See [Configuration Reference](https://cli.vuejs.org/config/).
39
+
40
+ ### 使用场景
41
+
42
+ 弹窗组件的封装可以提高代码的复用性和可维护性,使开发者能够更加方便地在不同的场景中使用和管理弹窗,根据弹窗组件规范设计图,通过封装,可以统一弹窗的样式和行为,并提供简洁的接口供其他组件或页面调用,这样,开发者可以更加专注于业务逻辑的实现,而无需重复编写弹窗的代码。弹窗组件中设有默认的头部、内容区和尾部,这三部分分别可使用插槽自定义内容,弹窗内设有默认头部关闭按钮、取消和确定按钮,底部关闭按钮等。
43
+
44
+ ### 目录结构
45
+
46
+ ```
47
+ ├─.env.development
48
+ ├─.env.production
49
+ ├─.eslintignore
50
+ ├─.eslintrc.js
51
+ ├─.gitignore
52
+ ├─.npmignore
53
+ ├─.prettierignore
54
+ ├─.prettierrc
55
+ ├─.yarnignore
56
+ ├─babel.config.js
57
+ ├─examples ------------------------- // 示例
58
+ │ ├─App.vue ------------------------ // 入口文件
59
+ │ ├─assets
60
+ │ │ ├─css
61
+ │ │ │ └─style.scss
62
+ │ │ └─images
63
+ │ │  ├─icon_bottomClose.png
64
+ │ │  └─icon_close.png
65
+ │ ├─main.js ------------------------ // 全局注册文件
66
+ │ └─views
67
+ │  └─HomeView.vue ----------------- // 组件引用示例
68
+ ├─jsconfig.json
69
+ ├─lib
70
+ │ ├─demo.html
71
+ │ ├─gwell-dialog.common.js
72
+ │ ├─gwell-dialog.common.js.map
73
+ │ ├─gwell-dialog.css
74
+ │ ├─gwell-dialog.umd.js
75
+ │ ├─gwell-dialog.umd.js.map
76
+ │ ├─gwell-dialog.umd.min.js
77
+ │ └─gwell-dialog.umd.min.js.map
78
+ ├─package.json
79
+ ├─packages
80
+ │ ├─dialog
81
+ │ │ ├─index.js --------------------- // 导出弹窗组件
82
+ │ │ └─main.vue --------------------- // 弹窗组件开发
83
+ │ └─index.js ----------------------- // 整合并导出所有组件,实现组件的全局注册
84
+ ├─postcss.config.js ---------------- // 屏幕适配
85
+ ├─public
86
+ │ ├─favicon.ico
87
+ │ └─index.html
88
+ ├─README.md
89
+ ├─vue.config.js -------------------- // 配置入口文件
90
+ └─yarn.lock
91
+ ```
92
+
93
+ ### 可传参数
94
+
95
+ ```json
96
+ {
97
+ showDialog: Boolean, //是否显示弹窗
98
+ title: String, //弹窗标题
99
+ closeOnClickOverlay: {
100
+ //点击弹窗外部可以关闭弹窗
101
+ type: Boolean,
102
+ default: true
103
+ },
104
+ className: {
105
+ //自定义内容区域类名
106
+ type: String,
107
+ default: '' // centered:居中, veryBottom:最底部弹窗,bottomed:底部, special:特殊类型
108
+ },
109
+ buttons: {
110
+ //自定义按钮
111
+ type: Array,
112
+ default: () => [
113
+ //如果不传按钮则默认显示确定和关闭按钮
114
+ // {
115
+ // label: '', //标题,可以是html类型
116
+ // action: Function, //方法
117
+ // className: '', //自定义样式 cancelBottom:最底部取消按钮,red:红色按钮,custom:自定义按钮
118
+ // style: {}
119
+ // }
120
+ ]
121
+ },
122
+ removeDefaultBtn: {
123
+ type: Array, //传入默认按钮defaultBtn的type值就会删除对应的默认按钮,例如:['confirm']
124
+ default: () => []
125
+ },
126
+ isShowDefaultBtn: {
127
+ //是否显示默认按钮
128
+ type: Boolean,
129
+ default: true
130
+ },
131
+ cancelButtonText: String, //取消按钮文案
132
+ confirmButtonText: String, //确认按钮文案
133
+ cancelButtonColor: String, //取消按钮颜色
134
+ confirmButtonColor: String, //确认按钮颜色
135
+ isShowCloseBtn: {
136
+ //是否显示顶部关闭按钮
137
+ type: Boolean,
138
+ default: false
139
+ },
140
+ isShowCloseBottomBtn: {
141
+ //是否显示底部关闭按钮
142
+ type: Boolean,
143
+ default: false
144
+ },
145
+ overlay: {
146
+ //是否展示遮罩层
147
+ type: Boolean,
148
+ default: true
149
+ },
150
+ overlayClass: String, //自定义遮罩层类名
151
+ overlayStyle: {
152
+ //自定义遮罩层样式
153
+ type: Object,
154
+ default: () => {}
155
+ },
156
+ lockScroll: {
157
+ //锁定背景滚动
158
+ type: Boolean,
159
+ default: true
160
+ },
161
+ beforeClose: {
162
+ //关闭前的回调函数
163
+ type: Function,
164
+ default: null
165
+ },
166
+ transition: {
167
+ //动画类名
168
+ type: String,
169
+ default: 'fade'
170
+ }
171
+ }
172
+ ```
173
+
174
+ ### 使用教程
175
+
176
+ 当前包使用主版本号区分 Vue 版本:
177
+
178
+ - `1.x`、`2.x`:Vue2 版本,由 `vue2` 分支维护;
179
+ - `3.x`:Vue3 版本,由 `vue3` 分支维护。
180
+
181
+ 1、第一步安装:
182
+
183
+ Vue3 项目安装当前版本:
184
+
185
+ ```shell
186
+ npm install gwell-dialog@^3.0.0
187
+ ```
188
+
189
+
190
+
191
+ ```shell
192
+ yarn add gwell-dialog@^3.0.0
193
+ ```
194
+
195
+ Vue2 项目请安装 `1.x` 或 `2.x` 版本:
196
+
197
+ ```shell
198
+ npm install gwell-dialog@^2.0.0
199
+ ```
200
+
201
+ 2、第二步注册组件
202
+
203
+ ```js
204
+ import { createApp } from 'vue';
205
+ import GwellDialog from 'gwell-dialog';
206
+ import 'gwell-dialog/lib/gwell-dialog.css';
207
+
208
+ const app = createApp(App);
209
+ app.use(GwellDialog);
210
+ app.mount('#app');
211
+ ```
212
+
213
+ 3、第三步使用
214
+
215
+ ```vue
216
+ <GwellDialog v-model:showDialog="showDialog" />
217
+ ```
218
+
219
+ ### 分支与版本发布
220
+
221
+ Git 分支约定:
222
+
223
+ - `vue2`:只维护 Vue2 代码,发布 `1.x`、`2.x`;
224
+ - `vue3`:只维护 Vue3 代码,发布 `3.x`。
225
+
226
+ npm 不根据 Git 分支区分代码,必须在对应分支确认代码和版本后再发布:
227
+
228
+ ```shell
229
+ git checkout vue2
230
+ npm version 2.0.0
231
+ npm publish --tag vue2
232
+ ```
233
+
234
+ ```shell
235
+ git checkout vue3
236
+ npm version 3.0.0
237
+ npm publish --tag vue3
238
+ ```
239
+
240
+ 发布脚本会校验当前 Git 分支、版本号和 Vue peerDependencies,防止把 Vue2 代码发布到 Vue3 标签,或反向发布。脚本只会在校验和构建通过后执行 `npm publish`,不会自动切换分支:
241
+
242
+ ```shell
243
+ # Vue2 分支:版本必须是 1.x 或 2.x,发布到 vue2 标签
244
+ npm run release:vue2
245
+
246
+ # Vue3 分支:版本必须是 3.x,发布到 vue3 标签
247
+ npm run release:vue3
248
+ ```
249
+
250
+ 如果只想检查,不发布:
251
+
252
+ ```shell
253
+ npm run release:check:vue2
254
+ npm run release:check:vue3
255
+ ```
256
+
257
+ 发布前检查:
258
+
259
+ ```shell
260
+ git branch --show-current
261
+ npm pkg get version
262
+ npm pkg get peerDependencies
263
+ npm run lint
264
+ npm run build
265
+ npm run lib
266
+ ```
267
+
268
+ Vue2 版本的 `peerDependencies.vue` 应为 `^2.6.0`,Vue3 版本应为 `^3.2.0`。同一个 npm 包的版本不能覆盖,发布后只能递增版本号。
269
+
270
+ 过渡期建议将 `latest` 保持在 Vue2 最新稳定版本,Vue3 使用 `vue3` 标签;Vue3 验证稳定后,再将 `latest` 切换到 `3.x`:
271
+
272
+ ```shell
273
+ npm dist-tag add gwell-dialog@3.0.0 latest
274
+ npm dist-tag add gwell-dialog@2.0.0 legacy
275
+ ```
276
+
277
+ 1、在 package.json 文件的 scripts 中配置 lib 编译 组件库命令
278
+ 主要需要四个参数:
279
+
280
+ 1. target: 默认为构建应用,改为 lib 即可启用构建库模式
281
+ 2. name: 输出文件名
282
+ 3. dest: 输出目录,默认为 dist,这里我们改为** lib**
283
+ 4. entry: 入口文件路径,默认为 src/App.vue,这里改为 packages/index.js
284
+ 例如:"lib": "vue-cli-service build --target lib --name gwell-dialog --dest lib packages/index.js"
285
+ 2、然后 执行编译命令
286
+
287
+ ```shell
288
+ npm run lib
289
+ ```
290
+
291
+ 3、在 npm 官网注册后登录 npm
292
+
293
+ ```shell
294
+ npm login
295
+ ```
296
+
297
+ 4、如果以前改过 npm 的镜像地址,比如使用了淘宝镜像,就先改回来
298
+
299
+ ```shell
300
+ npm config set registry https://registry.npmjs.org
301
+ ```
302
+
303
+ 5、发布
304
+
305
+ ```shell
306
+ npm publish
307
+ ```
308
+
309
+ 6、修改 npm 包
310
+
311
+ ```shell
312
+ npm version patch
313
+ ```