@vtj/materials 0.10.1-alpha.7 → 0.10.1

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.
@@ -1,324 +1,324 @@
1
- <template>
2
- <view class="uni-popup-dialog">
3
- <view class="uni-dialog-title">
4
- <text
5
- class="uni-dialog-title-text"
6
- :class="['uni-popup__' + dialogType]"
7
- >{{ titleText }}</text
8
- >
9
- </view>
10
- <view v-if="mode === 'base'" class="uni-dialog-content">
11
- <slot>
12
- <text class="uni-dialog-content-text">{{ content }}</text>
13
- </slot>
14
- </view>
15
- <view v-else class="uni-dialog-content">
16
- <slot>
17
- <input
18
- class="uni-dialog-input"
19
- :maxlength="maxlength"
20
- v-model="val"
21
- :type="inputType"
22
- :placeholder="placeholderText"
23
- :focus="focus" />
24
- </slot>
25
- </view>
26
- <view class="uni-dialog-button-group">
27
- <view class="uni-dialog-button" v-if="showClose" @click="closeDialog">
28
- <text class="uni-dialog-button-text">{{ closeText }}</text>
29
- </view>
30
- <view
31
- class="uni-dialog-button"
32
- :class="showClose ? 'uni-border-left' : ''"
33
- @click="onOk">
34
- <text class="uni-dialog-button-text uni-button-color">{{
35
- okText
36
- }}</text>
37
- </view>
38
- </view>
39
- </view>
40
- </template>
41
-
42
- <script>
43
- import popup from '../uni-popup/popup.js';
44
- import { initVueI18n } from '@dcloudio/uni-i18n';
45
- import messages from '../uni-popup/i18n/index.js';
46
- const { t } = initVueI18n(messages);
47
- /**
48
- * PopUp 弹出层-对话框样式
49
- * @description 弹出层-对话框样式
50
- * @tutorial https://ext.dcloud.net.cn/plugin?id=329
51
- * @property {String} value input 模式下的默认值
52
- * @property {String} placeholder input 模式下输入提示
53
- * @property {Boolean} focus input模式下是否自动聚焦,默认为true
54
- * @property {String} type = [success|warning|info|error] 主题样式
55
- * @value success 成功
56
- * @value warning 提示
57
- * @value info 消息
58
- * @value error 错误
59
- * @property {String} mode = [base|input] 模式、
60
- * @value base 基础对话框
61
- * @value input 可输入对话框
62
- * @showClose {Boolean} 是否显示关闭按钮
63
- * @property {String} content 对话框内容
64
- * @property {Boolean} beforeClose 是否拦截取消事件
65
- * @property {Number} maxlength 输入
66
- * @event {Function} confirm 点击确认按钮触发
67
- * @event {Function} close 点击取消按钮触发
68
- */
69
-
70
- export default {
71
- name: 'uniPopupDialog',
72
- mixins: [popup],
73
- emits: ['confirm', 'close', 'update:modelValue', 'input'],
74
- props: {
75
- inputType: {
76
- type: String,
77
- default: 'text'
78
- },
79
- showClose: {
80
- type: Boolean,
81
- default: true
82
- },
83
- // #ifdef VUE2
84
- value: {
85
- type: [String, Number],
86
- default: ''
87
- },
88
- // #endif
89
- // #ifdef VUE3
90
- modelValue: {
91
- type: [Number, String],
92
- default: ''
93
- },
94
- // #endif
95
-
96
- placeholder: {
97
- type: [String, Number],
98
- default: ''
99
- },
100
- type: {
101
- type: String,
102
- default: 'error'
103
- },
104
- mode: {
105
- type: String,
106
- default: 'base'
107
- },
108
- title: {
109
- type: String,
110
- default: ''
111
- },
112
- content: {
113
- type: String,
114
- default: ''
115
- },
116
- beforeClose: {
117
- type: Boolean,
118
- default: false
119
- },
120
- cancelText: {
121
- type: String,
122
- default: ''
123
- },
124
- confirmText: {
125
- type: String,
126
- default: ''
127
- },
128
- maxlength: {
129
- type: Number,
130
- default: -1
131
- },
132
- focus: {
133
- type: Boolean,
134
- default: true
135
- }
136
- },
137
- data() {
138
- return {
139
- dialogType: 'error',
140
- val: ''
141
- };
142
- },
143
- computed: {
144
- okText() {
145
- return this.confirmText || t('uni-popup.ok');
146
- },
147
- closeText() {
148
- return this.cancelText || t('uni-popup.cancel');
149
- },
150
- placeholderText() {
151
- return this.placeholder || t('uni-popup.placeholder');
152
- },
153
- titleText() {
154
- return this.title || t('uni-popup.title');
155
- }
156
- },
157
- watch: {
158
- type(val) {
159
- this.dialogType = val;
160
- },
161
- mode(val) {
162
- if (val === 'input') {
163
- this.dialogType = 'info';
164
- }
165
- },
166
- value(val) {
167
- if (this.maxlength != -1 && this.mode === 'input') {
168
- this.val = val.slice(0, this.maxlength);
169
- } else {
170
- this.val = val;
171
- }
172
- },
173
- val(val) {
174
- // #ifdef VUE2
175
- // TODO 兼容 vue2
176
- this.$emit('input', val);
177
- // #endif
178
- // #ifdef VUE3
179
- // TODO 兼容 vue3
180
- this.$emit('update:modelValue', val);
181
- // #endif
182
- }
183
- },
184
- created() {
185
- // 对话框遮罩不可点击
186
- this.popup.disableMask();
187
- // this.popup.closeMask()
188
- if (this.mode === 'input') {
189
- this.dialogType = 'info';
190
- this.val = this.value;
191
- // #ifdef VUE3
192
- this.val = this.modelValue;
193
- // #endif
194
- } else {
195
- this.dialogType = this.type;
196
- }
197
- },
198
- methods: {
199
- /**
200
- * 点击确认按钮
201
- */
202
- onOk() {
203
- if (this.mode === 'input') {
204
- this.$emit('confirm', this.val);
205
- } else {
206
- this.$emit('confirm');
207
- }
208
- if (this.beforeClose) return;
209
- this.popup.close();
210
- },
211
- /**
212
- * 点击取消按钮
213
- */
214
- closeDialog() {
215
- this.$emit('close');
216
- if (this.beforeClose) return;
217
- this.popup.close();
218
- },
219
- close() {
220
- this.popup.close();
221
- }
222
- }
223
- };
224
- </script>
225
-
226
- <style lang="scss">
227
- .uni-popup-dialog {
228
- width: 300px;
229
- border-radius: 11px;
230
- background-color: #fff;
231
- }
232
-
233
- .uni-dialog-title {
234
- /* #ifndef APP-NVUE */
235
- display: flex;
236
- /* #endif */
237
- flex-direction: row;
238
- justify-content: center;
239
- padding-top: 25px;
240
- }
241
-
242
- .uni-dialog-title-text {
243
- font-size: 16px;
244
- font-weight: 500;
245
- }
246
-
247
- .uni-dialog-content {
248
- /* #ifndef APP-NVUE */
249
- display: flex;
250
- /* #endif */
251
- flex-direction: row;
252
- justify-content: center;
253
- align-items: center;
254
- padding: 20px;
255
- }
256
-
257
- .uni-dialog-content-text {
258
- font-size: 14px;
259
- color: #6c6c6c;
260
- }
261
-
262
- .uni-dialog-button-group {
263
- /* #ifndef APP-NVUE */
264
- display: flex;
265
- /* #endif */
266
- flex-direction: row;
267
- border-top-color: #f5f5f5;
268
- border-top-style: solid;
269
- border-top-width: 1px;
270
- }
271
-
272
- .uni-dialog-button {
273
- /* #ifndef APP-NVUE */
274
- display: flex;
275
- /* #endif */
276
-
277
- flex: 1;
278
- flex-direction: row;
279
- justify-content: center;
280
- align-items: center;
281
- height: 45px;
282
- }
283
-
284
- .uni-border-left {
285
- border-left-color: #f0f0f0;
286
- border-left-style: solid;
287
- border-left-width: 1px;
288
- }
289
-
290
- .uni-dialog-button-text {
291
- font-size: 16px;
292
- color: #333;
293
- }
294
-
295
- .uni-button-color {
296
- color: #007aff;
297
- }
298
-
299
- .uni-dialog-input {
300
- flex: 1;
301
- font-size: 14px;
302
- border: 1px #eee solid;
303
- height: 40px;
304
- padding: 0 10px;
305
- border-radius: 5px;
306
- color: #555;
307
- }
308
-
309
- .uni-popup__success {
310
- color: #4cd964;
311
- }
312
-
313
- .uni-popup__warn {
314
- color: #f0ad4e;
315
- }
316
-
317
- .uni-popup__error {
318
- color: #dd524d;
319
- }
320
-
321
- .uni-popup__info {
322
- color: #909399;
323
- }
324
- </style>
1
+ <template>
2
+ <view class="uni-popup-dialog">
3
+ <view class="uni-dialog-title">
4
+ <text
5
+ class="uni-dialog-title-text"
6
+ :class="['uni-popup__' + dialogType]"
7
+ >{{ titleText }}</text
8
+ >
9
+ </view>
10
+ <view v-if="mode === 'base'" class="uni-dialog-content">
11
+ <slot>
12
+ <text class="uni-dialog-content-text">{{ content }}</text>
13
+ </slot>
14
+ </view>
15
+ <view v-else class="uni-dialog-content">
16
+ <slot>
17
+ <input
18
+ class="uni-dialog-input"
19
+ :maxlength="maxlength"
20
+ v-model="val"
21
+ :type="inputType"
22
+ :placeholder="placeholderText"
23
+ :focus="focus" />
24
+ </slot>
25
+ </view>
26
+ <view class="uni-dialog-button-group">
27
+ <view class="uni-dialog-button" v-if="showClose" @click="closeDialog">
28
+ <text class="uni-dialog-button-text">{{ closeText }}</text>
29
+ </view>
30
+ <view
31
+ class="uni-dialog-button"
32
+ :class="showClose ? 'uni-border-left' : ''"
33
+ @click="onOk">
34
+ <text class="uni-dialog-button-text uni-button-color">{{
35
+ okText
36
+ }}</text>
37
+ </view>
38
+ </view>
39
+ </view>
40
+ </template>
41
+
42
+ <script>
43
+ import popup from '../uni-popup/popup.js';
44
+ import { initVueI18n } from '@dcloudio/uni-i18n';
45
+ import messages from '../uni-popup/i18n/index.js';
46
+ const { t } = initVueI18n(messages);
47
+ /**
48
+ * PopUp 弹出层-对话框样式
49
+ * @description 弹出层-对话框样式
50
+ * @tutorial https://ext.dcloud.net.cn/plugin?id=329
51
+ * @property {String} value input 模式下的默认值
52
+ * @property {String} placeholder input 模式下输入提示
53
+ * @property {Boolean} focus input模式下是否自动聚焦,默认为true
54
+ * @property {String} type = [success|warning|info|error] 主题样式
55
+ * @value success 成功
56
+ * @value warning 提示
57
+ * @value info 消息
58
+ * @value error 错误
59
+ * @property {String} mode = [base|input] 模式、
60
+ * @value base 基础对话框
61
+ * @value input 可输入对话框
62
+ * @showClose {Boolean} 是否显示关闭按钮
63
+ * @property {String} content 对话框内容
64
+ * @property {Boolean} beforeClose 是否拦截取消事件
65
+ * @property {Number} maxlength 输入
66
+ * @event {Function} confirm 点击确认按钮触发
67
+ * @event {Function} close 点击取消按钮触发
68
+ */
69
+
70
+ export default {
71
+ name: 'uniPopupDialog',
72
+ mixins: [popup],
73
+ emits: ['confirm', 'close', 'update:modelValue', 'input'],
74
+ props: {
75
+ inputType: {
76
+ type: String,
77
+ default: 'text'
78
+ },
79
+ showClose: {
80
+ type: Boolean,
81
+ default: true
82
+ },
83
+ // #ifdef VUE2
84
+ value: {
85
+ type: [String, Number],
86
+ default: ''
87
+ },
88
+ // #endif
89
+ // #ifdef VUE3
90
+ modelValue: {
91
+ type: [Number, String],
92
+ default: ''
93
+ },
94
+ // #endif
95
+
96
+ placeholder: {
97
+ type: [String, Number],
98
+ default: ''
99
+ },
100
+ type: {
101
+ type: String,
102
+ default: 'error'
103
+ },
104
+ mode: {
105
+ type: String,
106
+ default: 'base'
107
+ },
108
+ title: {
109
+ type: String,
110
+ default: ''
111
+ },
112
+ content: {
113
+ type: String,
114
+ default: ''
115
+ },
116
+ beforeClose: {
117
+ type: Boolean,
118
+ default: false
119
+ },
120
+ cancelText: {
121
+ type: String,
122
+ default: ''
123
+ },
124
+ confirmText: {
125
+ type: String,
126
+ default: ''
127
+ },
128
+ maxlength: {
129
+ type: Number,
130
+ default: -1
131
+ },
132
+ focus: {
133
+ type: Boolean,
134
+ default: true
135
+ }
136
+ },
137
+ data() {
138
+ return {
139
+ dialogType: 'error',
140
+ val: ''
141
+ };
142
+ },
143
+ computed: {
144
+ okText() {
145
+ return this.confirmText || t('uni-popup.ok');
146
+ },
147
+ closeText() {
148
+ return this.cancelText || t('uni-popup.cancel');
149
+ },
150
+ placeholderText() {
151
+ return this.placeholder || t('uni-popup.placeholder');
152
+ },
153
+ titleText() {
154
+ return this.title || t('uni-popup.title');
155
+ }
156
+ },
157
+ watch: {
158
+ type(val) {
159
+ this.dialogType = val;
160
+ },
161
+ mode(val) {
162
+ if (val === 'input') {
163
+ this.dialogType = 'info';
164
+ }
165
+ },
166
+ value(val) {
167
+ if (this.maxlength != -1 && this.mode === 'input') {
168
+ this.val = val.slice(0, this.maxlength);
169
+ } else {
170
+ this.val = val;
171
+ }
172
+ },
173
+ val(val) {
174
+ // #ifdef VUE2
175
+ // TODO 兼容 vue2
176
+ this.$emit('input', val);
177
+ // #endif
178
+ // #ifdef VUE3
179
+ // TODO 兼容 vue3
180
+ this.$emit('update:modelValue', val);
181
+ // #endif
182
+ }
183
+ },
184
+ created() {
185
+ // 对话框遮罩不可点击
186
+ this.popup.disableMask();
187
+ // this.popup.closeMask()
188
+ if (this.mode === 'input') {
189
+ this.dialogType = 'info';
190
+ this.val = this.value;
191
+ // #ifdef VUE3
192
+ this.val = this.modelValue;
193
+ // #endif
194
+ } else {
195
+ this.dialogType = this.type;
196
+ }
197
+ },
198
+ methods: {
199
+ /**
200
+ * 点击确认按钮
201
+ */
202
+ onOk() {
203
+ if (this.mode === 'input') {
204
+ this.$emit('confirm', this.val);
205
+ } else {
206
+ this.$emit('confirm');
207
+ }
208
+ if (this.beforeClose) return;
209
+ this.popup.close();
210
+ },
211
+ /**
212
+ * 点击取消按钮
213
+ */
214
+ closeDialog() {
215
+ this.$emit('close');
216
+ if (this.beforeClose) return;
217
+ this.popup.close();
218
+ },
219
+ close() {
220
+ this.popup.close();
221
+ }
222
+ }
223
+ };
224
+ </script>
225
+
226
+ <style lang="scss">
227
+ .uni-popup-dialog {
228
+ width: 300px;
229
+ border-radius: 11px;
230
+ background-color: #fff;
231
+ }
232
+
233
+ .uni-dialog-title {
234
+ /* #ifndef APP-NVUE */
235
+ display: flex;
236
+ /* #endif */
237
+ flex-direction: row;
238
+ justify-content: center;
239
+ padding-top: 25px;
240
+ }
241
+
242
+ .uni-dialog-title-text {
243
+ font-size: 16px;
244
+ font-weight: 500;
245
+ }
246
+
247
+ .uni-dialog-content {
248
+ /* #ifndef APP-NVUE */
249
+ display: flex;
250
+ /* #endif */
251
+ flex-direction: row;
252
+ justify-content: center;
253
+ align-items: center;
254
+ padding: 20px;
255
+ }
256
+
257
+ .uni-dialog-content-text {
258
+ font-size: 14px;
259
+ color: #6c6c6c;
260
+ }
261
+
262
+ .uni-dialog-button-group {
263
+ /* #ifndef APP-NVUE */
264
+ display: flex;
265
+ /* #endif */
266
+ flex-direction: row;
267
+ border-top-color: #f5f5f5;
268
+ border-top-style: solid;
269
+ border-top-width: 1px;
270
+ }
271
+
272
+ .uni-dialog-button {
273
+ /* #ifndef APP-NVUE */
274
+ display: flex;
275
+ /* #endif */
276
+
277
+ flex: 1;
278
+ flex-direction: row;
279
+ justify-content: center;
280
+ align-items: center;
281
+ height: 45px;
282
+ }
283
+
284
+ .uni-border-left {
285
+ border-left-color: #f0f0f0;
286
+ border-left-style: solid;
287
+ border-left-width: 1px;
288
+ }
289
+
290
+ .uni-dialog-button-text {
291
+ font-size: 16px;
292
+ color: #333;
293
+ }
294
+
295
+ .uni-button-color {
296
+ color: #007aff;
297
+ }
298
+
299
+ .uni-dialog-input {
300
+ flex: 1;
301
+ font-size: 14px;
302
+ border: 1px #eee solid;
303
+ height: 40px;
304
+ padding: 0 10px;
305
+ border-radius: 5px;
306
+ color: #555;
307
+ }
308
+
309
+ .uni-popup__success {
310
+ color: #4cd964;
311
+ }
312
+
313
+ .uni-popup__warn {
314
+ color: #f0ad4e;
315
+ }
316
+
317
+ .uni-popup__error {
318
+ color: #dd524d;
319
+ }
320
+
321
+ .uni-popup__info {
322
+ color: #909399;
323
+ }
324
+ </style>
package/src/version.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2025, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/materials
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.10.1-alpha.7
5
+ * @version 0.10.1
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export const version = '0.10.1-alpha.7';
8
+ export const version = '0.10.1';