@netang/quasar 0.0.101 → 0.0.102

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 (164) hide show
  1. package/.editorconfig +12 -0
  2. package/LICENSE +21 -21
  3. package/README.md +11 -11
  4. package/_docs/docs/.vuepress/client.js +8 -8
  5. package/_docs/docs/.vuepress/config.js +40 -40
  6. package/_docs/docs/.vuepress/configs/index.js +2 -2
  7. package/_docs/docs/.vuepress/configs/navbar/index.js +1 -1
  8. package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -16
  9. package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -1
  10. package/_docs/docs/.vuepress/configs/sidebar/zh.js +75 -75
  11. package/_docs/docs/.vuepress/public/css/index.css +3 -3
  12. package/_docs/docs/.vuepress/styles/index.scss +3 -3
  13. package/_docs/docs/components/column-title.md +25 -25
  14. package/_docs/docs/components/data.md +66 -66
  15. package/_docs/docs/components/dialog.md +59 -59
  16. package/_docs/docs/components/dragger.md +26 -26
  17. package/_docs/docs/components/editor-code.md +16 -16
  18. package/_docs/docs/components/empty.md +13 -13
  19. package/_docs/docs/components/field-date.md +16 -16
  20. package/_docs/docs/components/field-text.md +57 -57
  21. package/_docs/docs/components/field-tree.md +21 -21
  22. package/_docs/docs/components/img.md +25 -25
  23. package/_docs/docs/components/input-number.md +21 -21
  24. package/_docs/docs/components/list-menu-item.md +21 -21
  25. package/_docs/docs/components/list-menu.md +21 -21
  26. package/_docs/docs/components/power-page.md +21 -21
  27. package/_docs/docs/components/price.md +21 -21
  28. package/_docs/docs/components/render.md +12 -12
  29. package/_docs/docs/components/search-item.md +10 -10
  30. package/_docs/docs/components/search.md +12 -12
  31. package/_docs/docs/components/select.md +11 -11
  32. package/_docs/docs/components/splitter.md +15 -15
  33. package/_docs/docs/components/table-column-fixed.md +20 -20
  34. package/_docs/docs/components/table-pagination.md +20 -20
  35. package/_docs/docs/components/table-splitter.md +20 -20
  36. package/_docs/docs/components/table-summary.md +20 -20
  37. package/_docs/docs/components/table.md +25 -25
  38. package/_docs/docs/components/thumbnail.md +18 -18
  39. package/_docs/docs/components/toolbar.md +9 -9
  40. package/_docs/docs/components/uploader-query.md +19 -19
  41. package/_docs/docs/components/uploader.md +16 -16
  42. package/_docs/docs/components/value-format.md +26 -26
  43. package/_docs/docs/index.md +1 -1
  44. package/_docs/docs/utils/alert.md +26 -26
  45. package/_docs/docs/utils/area.md +112 -112
  46. package/_docs/docs/utils/arr.md +80 -80
  47. package/_docs/docs/utils/auth.md +101 -101
  48. package/_docs/docs/utils/bus.md +18 -18
  49. package/_docs/docs/utils/confirm.md +31 -31
  50. package/_docs/docs/utils/copy.md +22 -22
  51. package/_docs/docs/utils/dialog.md +98 -98
  52. package/_docs/docs/utils/dict.md +50 -50
  53. package/_docs/docs/utils/dictOptions.md +27 -27
  54. package/_docs/docs/utils/form.md +33 -33
  55. package/_docs/docs/utils/getData.md +60 -60
  56. package/_docs/docs/utils/getFile.md +21 -21
  57. package/_docs/docs/utils/getImage.md +33 -33
  58. package/_docs/docs/utils/getTime.md +51 -51
  59. package/_docs/docs/utils/index.md +1 -1
  60. package/_docs/docs/utils/loading.md +18 -18
  61. package/_docs/docs/utils/notify.md +29 -29
  62. package/_docs/docs/utils/power.md +353 -353
  63. package/_docs/docs/utils/previewImage.md +11 -11
  64. package/_docs/docs/utils/price.md +45 -45
  65. package/_docs/docs/utils/rule.md +30 -30
  66. package/_docs/docs/utils/ruleValid.md +31 -31
  67. package/_docs/docs/utils/symbols.md +30 -30
  68. package/_docs/docs/utils/table.md +194 -194
  69. package/_docs/docs/utils/timestamp.md +27 -27
  70. package/_docs/docs/utils/toast.md +27 -27
  71. package/_docs/docs/utils/tree.md +174 -174
  72. package/_docs/docs/utils/uploader.md +29 -29
  73. package/_docs/package.json +11 -11
  74. package/components/column-title/index.vue +37 -37
  75. package/components/data/index.vue +20 -20
  76. package/components/dialog/index.vue +372 -372
  77. package/components/dragger/index.vue +203 -203
  78. package/components/drawer/index.vue +303 -303
  79. package/components/editor-code/index.vue +289 -289
  80. package/components/empty/index.vue +71 -71
  81. package/components/field-date/index.vue +850 -850
  82. package/components/field-date/methods.js +100 -100
  83. package/components/field-table/index.vue +1222 -1222
  84. package/components/field-text/index.vue +165 -165
  85. package/components/field-tree/index.vue +739 -659
  86. package/components/img/index.vue +202 -202
  87. package/components/input-number/index.vue +546 -546
  88. package/components/list-menu/index.vue +149 -149
  89. package/components/list-menu-item/index.vue +79 -79
  90. package/components/power-page/index.vue +92 -92
  91. package/components/price/index.vue +188 -188
  92. package/components/private/components/index.js +11 -11
  93. package/components/private/components/move-to-tree/index.vue +154 -154
  94. package/components/private/edit-power-data/index.vue +816 -816
  95. package/components/private/table-visible-columns-button/index.vue +109 -109
  96. package/components/render/index.vue +150 -150
  97. package/components/search/index.vue +222 -222
  98. package/components/search-item/index.vue +210 -210
  99. package/components/select/index.vue +177 -177
  100. package/components/splitter/index.vue +415 -415
  101. package/components/table/index.vue +456 -456
  102. package/components/table-column-fixed/index.vue +112 -112
  103. package/components/table-pagination/index.vue +192 -192
  104. package/components/table-splitter/index.vue +360 -360
  105. package/components/table-summary/index.vue +110 -110
  106. package/components/thumbnail/index.vue +72 -72
  107. package/components/toolbar/container.vue +31 -31
  108. package/components/toolbar/index.vue +136 -136
  109. package/components/uploader/index.vue +158 -158
  110. package/components/uploader-query/index.vue +758 -758
  111. package/components/value-format/index.vue +274 -274
  112. package/configs/area3.js +1 -1
  113. package/docs/css/index.css +3 -3
  114. package/package.json +24 -24
  115. package/sass/common.scss +174 -174
  116. package/sass/index.scss +14 -14
  117. package/sass/line.scss +39 -39
  118. package/sass/quasar/btn.scss +46 -46
  119. package/sass/quasar/common.scss +3 -3
  120. package/sass/quasar/dialog.scss +7 -7
  121. package/sass/quasar/drawer.scss +6 -6
  122. package/sass/quasar/field.scss +243 -243
  123. package/sass/quasar/loading.scss +6 -6
  124. package/sass/quasar/menu.scss +8 -8
  125. package/sass/quasar/table.scss +150 -150
  126. package/sass/quasar/toolbar.scss +22 -22
  127. package/store/index.js +29 -29
  128. package/utils/$auth.js +127 -127
  129. package/utils/$form.js +56 -56
  130. package/utils/$power.js +1215 -1215
  131. package/utils/$rule.js +13 -13
  132. package/utils/$ruleValid.js +10 -10
  133. package/utils/$table.js +999 -999
  134. package/utils/$tree.js +713 -713
  135. package/utils/alert.js +12 -12
  136. package/utils/area.js +400 -400
  137. package/utils/arr.js +51 -51
  138. package/utils/bus.js +6 -6
  139. package/utils/config.js +52 -52
  140. package/utils/confirm.js +11 -11
  141. package/utils/copy.js +30 -30
  142. package/utils/dialog.js +36 -36
  143. package/utils/dict.js +21 -21
  144. package/utils/dictOptions.js +28 -28
  145. package/utils/getData.js +73 -73
  146. package/utils/getFile.js +40 -40
  147. package/utils/getImage.js +153 -153
  148. package/utils/getTime.js +106 -106
  149. package/utils/index.js +61 -61
  150. package/utils/loading.js +15 -15
  151. package/utils/notify.js +13 -13
  152. package/utils/previewImage.js +10 -10
  153. package/utils/price.js +18 -18
  154. package/utils/symbols.js +18 -18
  155. package/utils/timestamp.js +18 -18
  156. package/utils/toast.js +13 -13
  157. package/utils/uploader/aliyun.js +6 -6
  158. package/utils/uploader/local.js +8 -8
  159. package/utils/uploader/qiniu.js +321 -321
  160. package/utils/uploader.js +1059 -1059
  161. package/utils/useAuth.js +30 -30
  162. package/utils/useRouter.js +47 -47
  163. package/utils/useSearch.js +496 -496
  164. package/utils/useUploader.js +53 -53
@@ -1,372 +1,372 @@
1
- <template>
2
- <q-dialog
3
- class="n-dialog-proxy"
4
- ref="dialogRef"
5
- v-model="currentModelValue"
6
- v-bind="$attrs"
7
- @hide="onDialogHide"
8
- >
9
- <q-card class="flex column" :style="customStyle">
10
-
11
- <!-- 头部 -->
12
- <q-toolbar class="n-line--bottom">
13
- <!-- 标题 -->
14
- <q-toolbar-title>{{currentTitle}}</q-toolbar-title>
15
- <!-- 关闭按钮 -->
16
- <q-btn flat round dense icon="close" v-close-popup v-if="close" />
17
- </q-toolbar>
18
-
19
- <!-- 内容 -->
20
- <q-card-section class="n-flex-1 no-padding">
21
- <q-layout
22
- class="absolute-full"
23
- view="hHh lpr fFf"
24
- container
25
- >
26
- <q-page-container>
27
- <slot
28
- v-bind="props"
29
- v-if="$slots.default"
30
- />
31
- <component
32
- :is="comp"
33
- v-bind="props"
34
- v-else
35
- />
36
- </q-page-container>
37
- </q-layout>
38
- </q-card-section>
39
-
40
- <!-- 底部 -->
41
- <q-card-actions class="n-line--top" align="right" v-if="bottom">
42
- <!-- 取消按钮 -->
43
- <q-btn label="取消" color="primary" @click="onDialogCancel" flat v-close-popup v-if="cancel" />
44
- <!-- 确定按钮 -->
45
- <q-btn label="确定" color="primary" @click="onDialogConfirm" flat />
46
- </q-card-actions>
47
- </q-card>
48
- </q-dialog>
49
- </template>
50
-
51
- <script>
52
- import { ref, computed, defineAsyncComponent, provide, watch } from 'vue'
53
- import { useDialogPluginComponent, useQuasar } from 'quasar'
54
-
55
- import $n_has from 'lodash/has'
56
- import $n_get from 'lodash/get'
57
- import $n_isFunction from 'lodash/isFunction'
58
-
59
- import $n_indexOf from '@netang/utils/indexOf'
60
- import $n_runAsync from '@netang/utils/runAsync'
61
- import $n_slash from '@netang/utils/slash'
62
- import $n_px from '@netang/utils/px'
63
-
64
- import components from '../private/components'
65
- import { NDialogKey } from '../../utils/symbols'
66
-
67
- import $n_toast from '../../utils/toast'
68
- import { configs } from '../../utils/config'
69
-
70
- const {
71
- // 自定义路由
72
- routers,
73
- } = configs
74
-
75
- export default {
76
-
77
- /**
78
- * 标识
79
- */
80
- name: 'NDialog',
81
-
82
- /**
83
- * 声明属性
84
- */
85
- props: {
86
- // 值
87
- modelValue: {
88
- type: Boolean,
89
- default: true,
90
- },
91
- // 组件标识
92
- name: String,
93
- // 路由组件路径
94
- path: String,
95
- // 路由组件参数
96
- query: Object,
97
- // 组件传参
98
- props: Object,
99
- // 标题
100
- title: String,
101
- // 是否显示关闭按钮
102
- close: {
103
- type: Boolean,
104
- default: true,
105
- },
106
- // 是否显示取消按钮
107
- cancel: Boolean,
108
- // 是否显示底部
109
- bottom: {
110
- type: Boolean,
111
- default: true,
112
- },
113
- // 点击确定方法
114
- onConfirm: Function,
115
- // 宽度
116
- width: {
117
- type: [String, Number],
118
- default: '50%',
119
- },
120
- // 高度
121
- height: {
122
- type: [String, Number],
123
- default: '80%',
124
- },
125
- // 最小宽度
126
- minWidth: {
127
- type: [String, Number],
128
- default: '600px',
129
- },
130
- // 是否全屏
131
- fullscreen: Boolean,
132
- // 是否是页面容器
133
- pageContainer: {
134
- type: Boolean,
135
- default: true,
136
- },
137
- },
138
-
139
- /**
140
- * 声明事件
141
- */
142
- emits: [
143
- 'update:modelValue',
144
- ...useDialogPluginComponent.emits
145
- ],
146
-
147
- /**
148
- * 组合式
149
- */
150
- setup(props, { emit }) {
151
-
152
- // ==========【数据】============================================================================================
153
-
154
- // quasar 对象
155
- const $q = useQuasar()
156
-
157
- const currentModelValue = ref(props.modelValue)
158
-
159
- watch(()=>props.modelValue, function (val) {
160
- currentModelValue.value = val
161
- })
162
-
163
- watch(currentModelValue, function (val) {
164
- emit('update:modelValue', val)
165
- })
166
-
167
- const {
168
- // 对话框节点
169
- dialogRef,
170
- // 对话框取消
171
- onDialogCancel,
172
- // 对话框隐藏
173
- onDialogHide,
174
- } = useDialogPluginComponent()
175
-
176
- // ==========【注入】============================================================================================
177
-
178
- // 对话框值
179
- const dialogValue = ref(null)
180
-
181
- // 组件提交方法
182
- let compSubmit
183
-
184
- // 向后代注入数据
185
- provide(NDialogKey, {
186
- // 值
187
- value: dialogValue,
188
- // 表格参数
189
- dialogProps: props,
190
- // 传参
191
- props: props.props,
192
- // 提交值
193
- submit(cb) {
194
- compSubmit = cb
195
- },
196
- // 提交
197
- confirm: onDialogConfirm,
198
- })
199
-
200
- // ==========【计算属性】=========================================================================================
201
-
202
- /**
203
- * 获取当前组件
204
- */
205
- const comp = computed(function () {
206
-
207
- // 组件
208
- let comp
209
-
210
- // 如果是路由路径
211
- if (props.path) {
212
- // 获取路由组件
213
- comp = $n_get(routers, `${$n_slash(props.path, 'start', false)}.component`)
214
-
215
- // 如果有组件标识
216
- } else if (props.name && $n_has(components, props.name)) {
217
- // 获取自定义组件
218
- comp = components[props.name]
219
- }
220
-
221
- // 如果没有组件
222
- if (! comp) {
223
- return
224
- }
225
-
226
- // 如果是方法, 则说明是异步组件
227
- if ($n_isFunction(comp)) {
228
- return defineAsyncComponent(comp)
229
- }
230
-
231
- // 返回组件
232
- return comp
233
- })
234
-
235
- /**
236
- * 自定义样式
237
- */
238
- const customStyle = computed(function () {
239
-
240
- const style = {}
241
-
242
- if (
243
- props.fullscreen
244
- || $q.platform.is.mobile
245
- || (props.width === '100%' && props.height === '100%')
246
- ) {
247
- style.width = '100vw'
248
- style.height = '100vh'
249
- style.borderRadius = 0
250
-
251
- } else {
252
- // 宽度
253
- setWH(style, 'width', 'vw')
254
- // 高度
255
- setWH(style, 'height', 'vh')
256
- // 最小宽度
257
- setWH(style, 'minWidth', 'vw')
258
- }
259
-
260
- return style
261
- })
262
-
263
- /**
264
- * 当前标题
265
- */
266
- const currentTitle = computed(function () {
267
-
268
- // 如果有自定义标题
269
- if (props.title) {
270
- return props.title
271
- }
272
-
273
- return ''
274
- })
275
-
276
- // ==========【方法】=============================================================================================
277
-
278
- /**
279
- * 设置宽高
280
- */
281
- function setWH(style, field, sign) {
282
- if (props[field]) {
283
- if ($n_indexOf(props[field], '%') > -1) {
284
- style[field] = props[field].replace('%', sign)
285
- } else {
286
- style[field] = $n_px(props[field])
287
- }
288
- }
289
- }
290
-
291
- /**
292
- * 隐藏对话框
293
- */
294
- function hide() {
295
- // 隐藏对话框
296
- dialogRef.value.hide()
297
- }
298
-
299
- /**
300
- * 对话框确认
301
- */
302
- async function onDialogConfirm() {
303
-
304
- // 如果有确定按钮
305
- if ($n_isFunction(props.onConfirm)) {
306
-
307
- if (! $n_isFunction(compSubmit)) {
308
- // 轻提示
309
- $n_toast({
310
- message: '未调用 $dialog.submit 方法',
311
- })
312
- return
313
- }
314
-
315
- const res = await $n_runAsync(props.onConfirm)(await $n_runAsync(compSubmit)(), hide)
316
- if (res === false) {
317
- return
318
- }
319
- }
320
-
321
- // 隐藏对话框
322
- hide()
323
- }
324
-
325
- // ==========【返回】=============================================================================================
326
-
327
- return {
328
- currentModelValue,
329
- // 自定义样式
330
- customStyle,
331
- // 组件
332
- comp,
333
- // 当前标题
334
- currentTitle,
335
-
336
- // 对话框节点
337
- dialogRef,
338
- // 对话框确定
339
- onDialogConfirm,
340
- // 对话框取消
341
- onDialogCancel,
342
- // 对话框隐藏
343
- onDialogHide,
344
- }
345
- }
346
- }
347
- </script>
348
-
349
- <style lang="scss">
350
- .n-dialog-proxy {
351
-
352
- &--fullscreen {
353
- .q-dialog__inner > div {
354
- border-radius: 0 !important;
355
- width: 100vw;
356
- height: 100vh;
357
- }
358
- }
359
-
360
- .q-dialog__inner > div {
361
- min-width: inherit;
362
- }
363
-
364
- .q-dialog__inner--minimized {
365
- padding: 0;
366
- > div {
367
- max-width: inherit !important;
368
- max-height: inherit !important;
369
- }
370
- }
371
- }
372
- </style>
1
+ <template>
2
+ <q-dialog
3
+ class="n-dialog-proxy"
4
+ ref="dialogRef"
5
+ v-model="currentModelValue"
6
+ v-bind="$attrs"
7
+ @hide="onDialogHide"
8
+ >
9
+ <q-card class="flex column" :style="customStyle">
10
+
11
+ <!-- 头部 -->
12
+ <q-toolbar class="n-line--bottom">
13
+ <!-- 标题 -->
14
+ <q-toolbar-title>{{currentTitle}}</q-toolbar-title>
15
+ <!-- 关闭按钮 -->
16
+ <q-btn flat round dense icon="close" v-close-popup v-if="close" />
17
+ </q-toolbar>
18
+
19
+ <!-- 内容 -->
20
+ <q-card-section class="n-flex-1 no-padding">
21
+ <q-layout
22
+ class="absolute-full"
23
+ view="hHh lpr fFf"
24
+ container
25
+ >
26
+ <q-page-container>
27
+ <slot
28
+ v-bind="props"
29
+ v-if="$slots.default"
30
+ />
31
+ <component
32
+ :is="comp"
33
+ v-bind="props"
34
+ v-else
35
+ />
36
+ </q-page-container>
37
+ </q-layout>
38
+ </q-card-section>
39
+
40
+ <!-- 底部 -->
41
+ <q-card-actions class="n-line--top" align="right" v-if="bottom">
42
+ <!-- 取消按钮 -->
43
+ <q-btn label="取消" color="primary" @click="onDialogCancel" flat v-close-popup v-if="cancel" />
44
+ <!-- 确定按钮 -->
45
+ <q-btn label="确定" color="primary" @click="onDialogConfirm" flat />
46
+ </q-card-actions>
47
+ </q-card>
48
+ </q-dialog>
49
+ </template>
50
+
51
+ <script>
52
+ import { ref, computed, defineAsyncComponent, provide, watch } from 'vue'
53
+ import { useDialogPluginComponent, useQuasar } from 'quasar'
54
+
55
+ import $n_has from 'lodash/has'
56
+ import $n_get from 'lodash/get'
57
+ import $n_isFunction from 'lodash/isFunction'
58
+
59
+ import $n_indexOf from '@netang/utils/indexOf'
60
+ import $n_runAsync from '@netang/utils/runAsync'
61
+ import $n_slash from '@netang/utils/slash'
62
+ import $n_px from '@netang/utils/px'
63
+
64
+ import components from '../private/components'
65
+ import { NDialogKey } from '../../utils/symbols'
66
+
67
+ import $n_toast from '../../utils/toast'
68
+ import { configs } from '../../utils/config'
69
+
70
+ const {
71
+ // 自定义路由
72
+ routers,
73
+ } = configs
74
+
75
+ export default {
76
+
77
+ /**
78
+ * 标识
79
+ */
80
+ name: 'NDialog',
81
+
82
+ /**
83
+ * 声明属性
84
+ */
85
+ props: {
86
+ // 值
87
+ modelValue: {
88
+ type: Boolean,
89
+ default: true,
90
+ },
91
+ // 组件标识
92
+ name: String,
93
+ // 路由组件路径
94
+ path: String,
95
+ // 路由组件参数
96
+ query: Object,
97
+ // 组件传参
98
+ props: Object,
99
+ // 标题
100
+ title: String,
101
+ // 是否显示关闭按钮
102
+ close: {
103
+ type: Boolean,
104
+ default: true,
105
+ },
106
+ // 是否显示取消按钮
107
+ cancel: Boolean,
108
+ // 是否显示底部
109
+ bottom: {
110
+ type: Boolean,
111
+ default: true,
112
+ },
113
+ // 点击确定方法
114
+ onConfirm: Function,
115
+ // 宽度
116
+ width: {
117
+ type: [String, Number],
118
+ default: '50%',
119
+ },
120
+ // 高度
121
+ height: {
122
+ type: [String, Number],
123
+ default: '80%',
124
+ },
125
+ // 最小宽度
126
+ minWidth: {
127
+ type: [String, Number],
128
+ default: '600px',
129
+ },
130
+ // 是否全屏
131
+ fullscreen: Boolean,
132
+ // 是否是页面容器
133
+ pageContainer: {
134
+ type: Boolean,
135
+ default: true,
136
+ },
137
+ },
138
+
139
+ /**
140
+ * 声明事件
141
+ */
142
+ emits: [
143
+ 'update:modelValue',
144
+ ...useDialogPluginComponent.emits
145
+ ],
146
+
147
+ /**
148
+ * 组合式
149
+ */
150
+ setup(props, { emit }) {
151
+
152
+ // ==========【数据】============================================================================================
153
+
154
+ // quasar 对象
155
+ const $q = useQuasar()
156
+
157
+ const currentModelValue = ref(props.modelValue)
158
+
159
+ watch(()=>props.modelValue, function (val) {
160
+ currentModelValue.value = val
161
+ })
162
+
163
+ watch(currentModelValue, function (val) {
164
+ emit('update:modelValue', val)
165
+ })
166
+
167
+ const {
168
+ // 对话框节点
169
+ dialogRef,
170
+ // 对话框取消
171
+ onDialogCancel,
172
+ // 对话框隐藏
173
+ onDialogHide,
174
+ } = useDialogPluginComponent()
175
+
176
+ // ==========【注入】============================================================================================
177
+
178
+ // 对话框值
179
+ const dialogValue = ref(null)
180
+
181
+ // 组件提交方法
182
+ let compSubmit
183
+
184
+ // 向后代注入数据
185
+ provide(NDialogKey, {
186
+ // 值
187
+ value: dialogValue,
188
+ // 表格参数
189
+ dialogProps: props,
190
+ // 传参
191
+ props: props.props,
192
+ // 提交值
193
+ submit(cb) {
194
+ compSubmit = cb
195
+ },
196
+ // 提交
197
+ confirm: onDialogConfirm,
198
+ })
199
+
200
+ // ==========【计算属性】=========================================================================================
201
+
202
+ /**
203
+ * 获取当前组件
204
+ */
205
+ const comp = computed(function () {
206
+
207
+ // 组件
208
+ let comp
209
+
210
+ // 如果是路由路径
211
+ if (props.path) {
212
+ // 获取路由组件
213
+ comp = $n_get(routers, `${$n_slash(props.path, 'start', false)}.component`)
214
+
215
+ // 如果有组件标识
216
+ } else if (props.name && $n_has(components, props.name)) {
217
+ // 获取自定义组件
218
+ comp = components[props.name]
219
+ }
220
+
221
+ // 如果没有组件
222
+ if (! comp) {
223
+ return
224
+ }
225
+
226
+ // 如果是方法, 则说明是异步组件
227
+ if ($n_isFunction(comp)) {
228
+ return defineAsyncComponent(comp)
229
+ }
230
+
231
+ // 返回组件
232
+ return comp
233
+ })
234
+
235
+ /**
236
+ * 自定义样式
237
+ */
238
+ const customStyle = computed(function () {
239
+
240
+ const style = {}
241
+
242
+ if (
243
+ props.fullscreen
244
+ || $q.platform.is.mobile
245
+ || (props.width === '100%' && props.height === '100%')
246
+ ) {
247
+ style.width = '100vw'
248
+ style.height = '100vh'
249
+ style.borderRadius = 0
250
+
251
+ } else {
252
+ // 宽度
253
+ setWH(style, 'width', 'vw')
254
+ // 高度
255
+ setWH(style, 'height', 'vh')
256
+ // 最小宽度
257
+ setWH(style, 'minWidth', 'vw')
258
+ }
259
+
260
+ return style
261
+ })
262
+
263
+ /**
264
+ * 当前标题
265
+ */
266
+ const currentTitle = computed(function () {
267
+
268
+ // 如果有自定义标题
269
+ if (props.title) {
270
+ return props.title
271
+ }
272
+
273
+ return ''
274
+ })
275
+
276
+ // ==========【方法】=============================================================================================
277
+
278
+ /**
279
+ * 设置宽高
280
+ */
281
+ function setWH(style, field, sign) {
282
+ if (props[field]) {
283
+ if ($n_indexOf(props[field], '%') > -1) {
284
+ style[field] = props[field].replace('%', sign)
285
+ } else {
286
+ style[field] = $n_px(props[field])
287
+ }
288
+ }
289
+ }
290
+
291
+ /**
292
+ * 隐藏对话框
293
+ */
294
+ function hide() {
295
+ // 隐藏对话框
296
+ dialogRef.value.hide()
297
+ }
298
+
299
+ /**
300
+ * 对话框确认
301
+ */
302
+ async function onDialogConfirm() {
303
+
304
+ // 如果有确定按钮
305
+ if ($n_isFunction(props.onConfirm)) {
306
+
307
+ if (! $n_isFunction(compSubmit)) {
308
+ // 轻提示
309
+ $n_toast({
310
+ message: '未调用 $dialog.submit 方法',
311
+ })
312
+ return
313
+ }
314
+
315
+ const res = await $n_runAsync(props.onConfirm)(await $n_runAsync(compSubmit)(), hide)
316
+ if (res === false) {
317
+ return
318
+ }
319
+ }
320
+
321
+ // 隐藏对话框
322
+ hide()
323
+ }
324
+
325
+ // ==========【返回】=============================================================================================
326
+
327
+ return {
328
+ currentModelValue,
329
+ // 自定义样式
330
+ customStyle,
331
+ // 组件
332
+ comp,
333
+ // 当前标题
334
+ currentTitle,
335
+
336
+ // 对话框节点
337
+ dialogRef,
338
+ // 对话框确定
339
+ onDialogConfirm,
340
+ // 对话框取消
341
+ onDialogCancel,
342
+ // 对话框隐藏
343
+ onDialogHide,
344
+ }
345
+ }
346
+ }
347
+ </script>
348
+
349
+ <style lang="scss">
350
+ .n-dialog-proxy {
351
+
352
+ &--fullscreen {
353
+ .q-dialog__inner > div {
354
+ border-radius: 0 !important;
355
+ width: 100vw;
356
+ height: 100vh;
357
+ }
358
+ }
359
+
360
+ .q-dialog__inner > div {
361
+ min-width: inherit;
362
+ }
363
+
364
+ .q-dialog__inner--minimized {
365
+ padding: 0;
366
+ > div {
367
+ max-width: inherit !important;
368
+ max-height: inherit !important;
369
+ }
370
+ }
371
+ }
372
+ </style>