@netang/quasar 0.0.53 → 0.0.54
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/_docs/docs/.vuepress/config.js +40 -0
- package/_docs/docs/.vuepress/configs/index.js +2 -0
- package/_docs/docs/.vuepress/configs/navbar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/navbar/zh.js +16 -0
- package/_docs/docs/.vuepress/configs/sidebar/index.js +1 -0
- package/_docs/docs/.vuepress/configs/sidebar/zh.js +20 -0
- package/_docs/docs/.vuepress/public/css/index.css +3 -0
- package/_docs/docs/.vuepress/styles/index.scss +3 -0
- package/_docs/docs/components/field-table.md +55 -0
- package/_docs/docs/components/field-tree.md +1 -0
- package/{docs → _docs}/docs/index.md +0 -0
- package/{docs → _docs}/docs/utils/alert.md +0 -0
- package/{docs → _docs}/docs/utils/confirm.md +0 -0
- package/{docs → _docs}/package.json +11 -11
- package/components/column-title/index.vue +2 -2
- package/components/data/index.vue +20 -23
- package/components/dialog/index.vue +26 -12
- package/components/dialog-table/index.vue +4 -2
- package/components/dragger/index.vue +3 -2
- package/components/drawer/index.vue +16 -9
- package/components/editor-code/index.vue +12 -5
- package/components/empty/index.vue +16 -1
- package/components/field-date/index.vue +48 -36
- package/components/field-table/index.vue +69 -43
- package/components/field-text/index.vue +6 -2
- package/components/field-tree/index.vue +40 -22
- package/components/input-number/index.vue +5 -4
- package/components/list-menu/index.vue +14 -2
- package/components/power-page/index.vue +10 -0
- package/components/private/components/index.js +7 -2
- package/components/private/components/move-to-tree/index.vue +7 -3
- package/components/private/edit-power-data/index.vue +92 -52
- package/components/private/table-visible-columns-button/index.vue +6 -2
- package/components/render/index.vue +21 -7
- package/components/search/index.vue +30 -2
- package/components/search-item/index.vue +24 -8
- package/components/select/index.vue +5 -2
- package/components/splitter/index.vue +13 -9
- package/components/table/index.vue +32 -5
- package/components/table-pagination/index.vue +0 -1
- package/components/table-splitter/index.vue +22 -3
- package/components/table-summary/index.vue +10 -3
- package/components/thumbnail/index.vue +16 -6
- package/components/toolbar/index.vue +0 -2
- package/components/uploader/index.vue +5 -2
- package/components/uploader-query/index.vue +48 -27
- package/components/value-format/index.vue +19 -12
- package/configs/area3.js +1 -0
- package/docs/404.html +33 -0
- package/docs/assets/404.html-60b35caa.js +1 -0
- package/docs/assets/404.html-d1e63d77.js +1 -0
- package/docs/assets/alert.html-568d4e94.js +1 -0
- package/docs/assets/alert.html-f5dbc3e9.js +1 -0
- package/docs/assets/app-8c3ae4de.js +6 -0
- package/docs/assets/back-to-top-8efcbe56.svg +1 -0
- package/docs/assets/confirm.html-7a1566f6.js +1 -0
- package/docs/assets/confirm.html-96f1b004.js +1 -0
- package/docs/assets/field-table.html-68d610b0.js +1 -0
- package/docs/assets/field-table.html-86cc3511.js +1 -0
- package/docs/assets/field-tree.html-45410c3c.js +1 -0
- package/docs/assets/field-tree.html-c98ac993.js +1 -0
- package/docs/assets/framework-204010b2.js +5 -0
- package/docs/assets/index.html-1695dd7c.js +1 -0
- package/docs/assets/index.html-65a4aa67.js +1 -0
- package/docs/assets/style-ac5a9aa6.css +1 -0
- package/docs/components/field-table.html +33 -0
- package/docs/components/field-tree.html +33 -0
- package/docs/index.html +33 -0
- package/docs/utils/alert.html +33 -0
- package/docs/utils/confirm.html +33 -0
- package/package.json +11 -2
- package/store/index.js +3 -20
- package/utils/alert.js +3 -1
- package/utils/area.js +27 -14
- package/utils/arr.js +6 -2
- package/utils/auth.js +40 -35
- package/utils/bus.js +1 -1
- package/utils/config.js +42 -15
- package/utils/{confrim.js → confirm.js} +1 -1
- package/utils/copy.js +18 -0
- package/utils/dialog.js +7 -3
- package/utils/dict.js +5 -28
- package/utils/dictOptions.js +24 -0
- package/utils/form.js +6 -2
- package/utils/getData.js +21 -9
- package/utils/getFile.js +11 -5
- package/utils/getImage.js +23 -12
- package/utils/getTime.js +9 -4
- package/utils/index.js +61 -0
- package/utils/loading.js +3 -1
- package/utils/notify.js +1 -1
- package/utils/power.js +164 -118
- package/utils/previewImage.js +4 -2
- package/utils/price.js +12 -3
- package/utils/rule.js +5 -9
- package/utils/ruleValid.js +10 -0
- package/utils/search.js +81 -50
- package/utils/table.js +119 -87
- package/utils/timestamp.js +2 -2
- package/utils/toast.js +1 -1
- package/utils/tree.js +69 -46
- package/utils/uploader/qiniu.js +31 -15
- package/utils/uploader.js +87 -56
- package/utils/useAuth.js +12 -5
- package/utils/useRouter.js +4 -4
- package/utils/useUploader.js +0 -5
- package/docs/docs/.vuepress/config.js +0 -32
- package/docs/docs/components/field-table.md +0 -1
- package/docs/docs/components/field-tree.md +0 -1
- package/utils/http.js +0 -251
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { defineUserConfig } from '@vuepress/cli'
|
|
3
|
+
import { defaultTheme } from '@vuepress/theme-default'
|
|
4
|
+
import { searchPlugin } from '@vuepress/plugin-search'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
navbarZh,
|
|
8
|
+
sidebarZh,
|
|
9
|
+
} from './configs'
|
|
10
|
+
|
|
11
|
+
export default defineUserConfig({
|
|
12
|
+
// 站点的标题
|
|
13
|
+
title: 'netang-quasar',
|
|
14
|
+
// 部署站点的基础路径
|
|
15
|
+
base: '/netang-quasar/',
|
|
16
|
+
// 打包目录
|
|
17
|
+
dest: path.join(__dirname, '../../../docs'),
|
|
18
|
+
// 主题
|
|
19
|
+
theme: defaultTheme({
|
|
20
|
+
locales: {
|
|
21
|
+
'/': {
|
|
22
|
+
// navbar
|
|
23
|
+
navbar: navbarZh,
|
|
24
|
+
// sidebar
|
|
25
|
+
sidebar: sidebarZh,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
// 插件
|
|
30
|
+
plugins: [
|
|
31
|
+
// 搜索
|
|
32
|
+
searchPlugin({
|
|
33
|
+
locales: {
|
|
34
|
+
'/': {
|
|
35
|
+
placeholder: '搜索',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}),
|
|
39
|
+
],
|
|
40
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './zh'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './zh'
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const sidebarZh = {
|
|
2
|
+
'/components/': [
|
|
3
|
+
{
|
|
4
|
+
text: 'Components 组件',
|
|
5
|
+
children: [
|
|
6
|
+
'/components/field-table',
|
|
7
|
+
'/components/field-tree',
|
|
8
|
+
],
|
|
9
|
+
}
|
|
10
|
+
],
|
|
11
|
+
'/utils/': [
|
|
12
|
+
{
|
|
13
|
+
text: 'Utils 工具',
|
|
14
|
+
children: [
|
|
15
|
+
'/utils/alert',
|
|
16
|
+
'/utils/confirm',
|
|
17
|
+
],
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# FieldTable 下拉表格
|
|
2
|
+
|
|
3
|
+
继承 `<q-field>` 所有特性
|
|
4
|
+
[中文文档](http://www.quasarchs.com/vue-components/field) [英文文档](https://quasar.dev/vue-components/field)
|
|
5
|
+
|
|
6
|
+
## FieldTable API
|
|
7
|
+
|
|
8
|
+
### FieldTable 属性
|
|
9
|
+
|
|
10
|
+
| 属性名 | 说明 | 类型 | 可选值 | 默认值 |
|
|
11
|
+
|--------------------------|-------------|---------------------|------------------------------------------|-----------------|
|
|
12
|
+
| value / v-model | 绑定值 | - | - | - |
|
|
13
|
+
| value-key | 值字段 | `String` | - | - |
|
|
14
|
+
| label-key | 标签字段 | `String` | - | - |
|
|
15
|
+
| value-type | 值类型 | `String` | `string` / `stringArray` / `objectArray` | objectArray |
|
|
16
|
+
| value-separator | 值分隔符 | `String` | - | , |
|
|
17
|
+
| path | 表格请求路径 | `String` | - | - |
|
|
18
|
+
| query | 请求参数 | `object` | - | - |
|
|
19
|
+
| data | 附加请求数据 | `object` | - | - |
|
|
20
|
+
| no-default-load-selected | 初始不加载已选数据 | `Boolean` | - | false |
|
|
21
|
+
| no-update-load-selected | 更新值时不加载已选数据 | `Boolean` | - | false |
|
|
22
|
+
| format-label | 格式化显示标签 | `Function` | - | - |
|
|
23
|
+
| show-keys | 下拉表格显示的字段数组 | `Array` | - | `[ 值字段, 标签字段 ]` |
|
|
24
|
+
| hide-search-keys | 隐藏搜索字段数组 | `Array` | - | - |
|
|
25
|
+
| filter-key | 默认筛选字段 | `Array` | - | `标签字段` |
|
|
26
|
+
| filter | 是否开启筛选 | `Boolean` | - | false |
|
|
27
|
+
| table-props | 表格声明属性 | `Object` | - | - |
|
|
28
|
+
| dialog-props | 对话框声明属性 | `Object` | - | - |
|
|
29
|
+
| no-dialog | 关闭对话框 | `Boolean` | - | false |
|
|
30
|
+
| columns | 表格列数据 | `Array` | - | - |
|
|
31
|
+
| rows | 行数据 | `Array` | - | - |
|
|
32
|
+
| multiple | 是否多选 | `Boolean` | - | false |
|
|
33
|
+
| collapse-tags | 多选模式下是否折叠标签 | `Boolean` | - | false |
|
|
34
|
+
| placeholder | 占位符 | `String` | - | - |
|
|
35
|
+
| clearable | 是否可清除 | `Boolean` | - | false |
|
|
36
|
+
| disable | 是否禁用 | `Boolean` | - | false |
|
|
37
|
+
| readonly | 是否只读 | `Boolean` | - | false |
|
|
38
|
+
| input-debounce | 输入防抖(毫秒) | `Number` / `String` | - | 500 |
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### FieldTable 插槽
|
|
42
|
+
|
|
43
|
+
| 插槽名 | 说明 |
|
|
44
|
+
|--------------------------|------------------------------------------|
|
|
45
|
+
| default | 自定义默认内容(如果存在,则会隐藏下拉表格,并提供接口自定义实现) |
|
|
46
|
+
|
|
47
|
+
### FieldTable `default` 默认插槽 对外暴露的方法
|
|
48
|
+
|
|
49
|
+
| 属性名 | 说明 | 类型 | 示例 |
|
|
50
|
+
|--------------------------|--|----------|-----|
|
|
51
|
+
| showValue | 显示的已选值 | `String` | - |
|
|
52
|
+
| selected | 已选数据 | `Array` | `[ { id: 1, ... }, { id: 2, ... } ]` |
|
|
53
|
+
| onRemove | 删除已选 | `Function` | `onRemove(index)` |
|
|
54
|
+
| onShowDialog | 显示对话框 | `Function` | - |
|
|
55
|
+
| onClear | 清空已选数据 | `Function` | - |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# FieldTree 下拉树
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
"docs:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"vuepress": "^2.0.0-beta.60"
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"scripts": {
|
|
4
|
+
"docs:dev": "vuepress dev docs",
|
|
5
|
+
"docs:build": "vuepress build docs"
|
|
6
|
+
},
|
|
7
|
+
"devDependencies": {
|
|
8
|
+
"@vuepress/plugin-search": "^2.0.0-beta.60",
|
|
9
|
+
"vuepress": "^2.0.0-beta.60"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<slot :data="data" />
|
|
3
|
-
</template>
|
|
4
|
-
|
|
5
|
-
<script>
|
|
6
|
-
export default {
|
|
7
|
-
/**
|
|
8
|
-
* 标识
|
|
9
|
-
*/
|
|
10
|
-
name: 'NData',
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 传参
|
|
14
|
-
*/
|
|
15
|
-
props: {
|
|
16
|
-
// 数据
|
|
17
|
-
data: {},
|
|
18
|
-
},
|
|
19
|
-
}
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<style>
|
|
23
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<slot :data="data" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
/**
|
|
8
|
+
* 标识
|
|
9
|
+
*/
|
|
10
|
+
name: 'NData',
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 传参
|
|
14
|
+
*/
|
|
15
|
+
props: {
|
|
16
|
+
// 数据
|
|
17
|
+
data: {},
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
@@ -52,11 +52,26 @@
|
|
|
52
52
|
import { ref, computed, defineAsyncComponent, provide, watch } from 'vue'
|
|
53
53
|
import { useDialogPluginComponent, useQuasar } from 'quasar'
|
|
54
54
|
|
|
55
|
-
import
|
|
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'
|
|
56
63
|
|
|
57
64
|
import components from '../private/components'
|
|
58
65
|
import { NDialogKey } from '../../utils/symbols'
|
|
59
66
|
|
|
67
|
+
import $n_toast from '../../utils/toast'
|
|
68
|
+
import { configs } from '../../utils/config'
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
// 自定义路由
|
|
72
|
+
routers,
|
|
73
|
+
} = configs
|
|
74
|
+
|
|
60
75
|
export default {
|
|
61
76
|
|
|
62
77
|
/**
|
|
@@ -184,10 +199,10 @@ export default {
|
|
|
184
199
|
|
|
185
200
|
function setWH(style, field, sign) {
|
|
186
201
|
if (props[field]) {
|
|
187
|
-
if ($
|
|
202
|
+
if ($n_indexOf(props[field], '%') > -1) {
|
|
188
203
|
style[field] = props[field].replace('%', sign)
|
|
189
204
|
} else {
|
|
190
|
-
style[field] = $
|
|
205
|
+
style[field] = $n_px(props[field])
|
|
191
206
|
}
|
|
192
207
|
}
|
|
193
208
|
}
|
|
@@ -231,10 +246,10 @@ export default {
|
|
|
231
246
|
// 如果是路由路径
|
|
232
247
|
if (props.route) {
|
|
233
248
|
// 获取路由组件
|
|
234
|
-
comp = $
|
|
249
|
+
comp = $n_get(routers, `${$n_slash(props.route, 'start', false)}.component`)
|
|
235
250
|
|
|
236
251
|
// 如果有组件标识
|
|
237
|
-
} else if (props.name && $
|
|
252
|
+
} else if (props.name && $n_has(components, props.name)) {
|
|
238
253
|
// 获取自定义组件
|
|
239
254
|
comp = components[props.name]
|
|
240
255
|
}
|
|
@@ -245,7 +260,7 @@ export default {
|
|
|
245
260
|
}
|
|
246
261
|
|
|
247
262
|
// 如果是方法, 则说明是异步组件
|
|
248
|
-
if ($
|
|
263
|
+
if ($n_isFunction(comp)) {
|
|
249
264
|
return defineAsyncComponent(comp)
|
|
250
265
|
}
|
|
251
266
|
|
|
@@ -265,7 +280,7 @@ export default {
|
|
|
265
280
|
|
|
266
281
|
return props.route ?
|
|
267
282
|
// 如果是路由路径, 则获取路由标题
|
|
268
|
-
$
|
|
283
|
+
$n_get(routers, `${$n_slash(props.route, 'start', false)}.meta.title`, '')
|
|
269
284
|
: ''
|
|
270
285
|
})
|
|
271
286
|
|
|
@@ -285,17 +300,17 @@ export default {
|
|
|
285
300
|
async function onDialogConfirm() {
|
|
286
301
|
|
|
287
302
|
// 如果有确定按钮
|
|
288
|
-
if ($
|
|
303
|
+
if ($n_isFunction(props.onConfirm)) {
|
|
289
304
|
|
|
290
|
-
if (! $
|
|
305
|
+
if (! $n_isFunction(compSubmit)) {
|
|
291
306
|
// 轻提示
|
|
292
|
-
$
|
|
307
|
+
$n_toast({
|
|
293
308
|
message: '未调用 $dialog.submit 方法',
|
|
294
309
|
})
|
|
295
310
|
return
|
|
296
311
|
}
|
|
297
312
|
|
|
298
|
-
const res = await $
|
|
313
|
+
const res = await $n_runAsync(props.onConfirm)(await $n_runAsync(compSubmit)(), hide)
|
|
299
314
|
if (res === false) {
|
|
300
315
|
return
|
|
301
316
|
}
|
|
@@ -330,7 +345,6 @@ export default {
|
|
|
330
345
|
</script>
|
|
331
346
|
|
|
332
347
|
<style lang="scss">
|
|
333
|
-
|
|
334
348
|
.n-dialog-proxy {
|
|
335
349
|
|
|
336
350
|
&--fullscreen {
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
</template>
|
|
6
6
|
|
|
7
7
|
<script>
|
|
8
|
+
import $n_dialog from '../../utils/dialog'
|
|
9
|
+
|
|
8
10
|
export default {
|
|
9
11
|
|
|
10
12
|
/**
|
|
@@ -43,7 +45,7 @@ export default {
|
|
|
43
45
|
/**
|
|
44
46
|
* 组合式
|
|
45
47
|
*/
|
|
46
|
-
setup(props
|
|
48
|
+
setup(props) {
|
|
47
49
|
|
|
48
50
|
// ==========【方法】=============================================================================================
|
|
49
51
|
|
|
@@ -53,7 +55,7 @@ export default {
|
|
|
53
55
|
function onDialog() {
|
|
54
56
|
|
|
55
57
|
// 创建对话框
|
|
56
|
-
$
|
|
58
|
+
$n_dialog.create({
|
|
57
59
|
// 标题
|
|
58
60
|
title: props.title,
|
|
59
61
|
// 宽
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<script>
|
|
19
19
|
import { ref, computed } from 'vue'
|
|
20
|
+
import $n_isValidArray from '@netang/utils/isValidArray'
|
|
20
21
|
|
|
21
22
|
export default {
|
|
22
23
|
|
|
@@ -68,7 +69,7 @@ export default {
|
|
|
68
69
|
*/
|
|
69
70
|
const isDrag = computed(function() {
|
|
70
71
|
return props.drag
|
|
71
|
-
&& $
|
|
72
|
+
&& $n_isValidArray(props.modelValue)
|
|
72
73
|
&& props.modelValue.length > 1
|
|
73
74
|
})
|
|
74
75
|
|
|
@@ -101,7 +102,7 @@ export default {
|
|
|
101
102
|
if (isDrag.value) {
|
|
102
103
|
|
|
103
104
|
// 如果为火狐浏览器, 则必须要setData
|
|
104
|
-
// if ($
|
|
105
|
+
// if ($n_ua.firefox) {
|
|
105
106
|
// e.dataTransfer.setData('info', e.target.id)
|
|
106
107
|
// }
|
|
107
108
|
|
|
@@ -23,6 +23,15 @@
|
|
|
23
23
|
import { ref, inject, nextTick, watch } from 'vue'
|
|
24
24
|
import { useQuasar } from 'quasar'
|
|
25
25
|
|
|
26
|
+
import $n_isNil from 'lodash/isNil'
|
|
27
|
+
|
|
28
|
+
import $n_router from '@netang/vue-utils/router'
|
|
29
|
+
|
|
30
|
+
import $n_storage from '@netang/utils/storage'
|
|
31
|
+
import $n_sleep from '@netang/utils/sleep'
|
|
32
|
+
import $n_percentValue from '@netang/utils/percentValue'
|
|
33
|
+
import $n_pxValue from '@netang/utils/pxValue'
|
|
34
|
+
|
|
26
35
|
import { layoutKey, emptyRenderFn } from 'quasar/src/utils/private/symbols.js'
|
|
27
36
|
|
|
28
37
|
import { NPowerKey } from '../../utils/symbols'
|
|
@@ -126,7 +135,7 @@ export default {
|
|
|
126
135
|
}
|
|
127
136
|
|
|
128
137
|
// 创建睡眠实例
|
|
129
|
-
const sleep = $
|
|
138
|
+
const sleep = $n_sleep()
|
|
130
139
|
|
|
131
140
|
// 缓存名
|
|
132
141
|
let cacheName = ''
|
|
@@ -138,10 +147,10 @@ export default {
|
|
|
138
147
|
if ($q.platform.is.mobile) {
|
|
139
148
|
|
|
140
149
|
// 获取手机端百分比值
|
|
141
|
-
let res = $
|
|
150
|
+
let res = $n_percentValue(props.mobileWidth, true)
|
|
142
151
|
|
|
143
152
|
// 如果是百分比值
|
|
144
|
-
if (! $
|
|
153
|
+
if (! $n_isNil(res)) {
|
|
145
154
|
// 原始尺寸 = 屏幕宽度 * 百分比
|
|
146
155
|
if (res) {
|
|
147
156
|
originalWidth = $q.screen.width * res
|
|
@@ -149,7 +158,7 @@ export default {
|
|
|
149
158
|
|
|
150
159
|
} else {
|
|
151
160
|
// 原始尺寸 = 屏幕宽度像素
|
|
152
|
-
res = $
|
|
161
|
+
res = $n_pxValue(props.mobileWidth)
|
|
153
162
|
if (res) {
|
|
154
163
|
originalWidth = res
|
|
155
164
|
}
|
|
@@ -159,10 +168,10 @@ export default {
|
|
|
159
168
|
} else if (props.drag && props.cache) {
|
|
160
169
|
|
|
161
170
|
// 设置缓存名
|
|
162
|
-
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $
|
|
171
|
+
cacheName = `drawer:${props.side}:${props.cache === true ? ($power && $power.routePath ? $power.routePath : $n_router.getRoute('path')) : props.cache}`
|
|
163
172
|
|
|
164
173
|
// 从缓存获取宽度
|
|
165
|
-
const cache = $
|
|
174
|
+
const cache = $n_storage.get(cacheName)
|
|
166
175
|
if (cache) {
|
|
167
176
|
originalWidth = cache
|
|
168
177
|
}
|
|
@@ -247,7 +256,7 @@ export default {
|
|
|
247
256
|
sleep(500)
|
|
248
257
|
.then(function () {
|
|
249
258
|
// 设置缓存(永久缓存)
|
|
250
|
-
$
|
|
259
|
+
$n_storage.set(cacheName, newWidth, 0)
|
|
251
260
|
})
|
|
252
261
|
}
|
|
253
262
|
}
|
|
@@ -268,8 +277,6 @@ export default {
|
|
|
268
277
|
</script>
|
|
269
278
|
|
|
270
279
|
<style lang="scss" scoped>
|
|
271
|
-
@import "@/assets/sass/var.scss";
|
|
272
|
-
|
|
273
280
|
.n-drawer {
|
|
274
281
|
// 拖拽手柄
|
|
275
282
|
&__drag-handle {
|
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
import { ref, watch, computed, onMounted } from 'vue'
|
|
11
11
|
|
|
12
12
|
import script from '@netang/utils/script'
|
|
13
|
+
import $n_isNumeric from '@netang/utils/isNumeric'
|
|
14
|
+
import $n_isValidValue from '@netang/utils/isValidValue'
|
|
15
|
+
import $n_sleep from '@netang/utils/sleep'
|
|
16
|
+
import $n_px from '@netang/utils/px'
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
import $n_toast from '../../utils/toast'
|
|
13
20
|
|
|
14
21
|
export default {
|
|
15
22
|
|
|
@@ -71,8 +78,8 @@ export default {
|
|
|
71
78
|
*/
|
|
72
79
|
const currentStyle = computed(function () {
|
|
73
80
|
return {
|
|
74
|
-
width: $
|
|
75
|
-
height: $
|
|
81
|
+
width: $n_isNumeric(props.width) ? $n_px(props.width) : props.width,
|
|
82
|
+
height: $n_isNumeric(props.height) ? $n_px(props.height) : props.height,
|
|
76
83
|
}
|
|
77
84
|
})
|
|
78
85
|
|
|
@@ -88,7 +95,7 @@ export default {
|
|
|
88
95
|
let stopValueWatcher = false
|
|
89
96
|
|
|
90
97
|
// 创建睡眠实例
|
|
91
|
-
const sleep = $
|
|
98
|
+
const sleep = $n_sleep()
|
|
92
99
|
|
|
93
100
|
// ==========【监听数据】=========================================================================================
|
|
94
101
|
|
|
@@ -238,14 +245,14 @@ export default {
|
|
|
238
245
|
// 如果语言为 json
|
|
239
246
|
if (
|
|
240
247
|
props.language === 'json'
|
|
241
|
-
&& $
|
|
248
|
+
&& $n_isValidValue(value)
|
|
242
249
|
) {
|
|
243
250
|
try {
|
|
244
251
|
value = JSON.stringify(JSON.parse(value))
|
|
245
252
|
|
|
246
253
|
} catch (e) {
|
|
247
254
|
// 轻提示
|
|
248
|
-
$
|
|
255
|
+
$n_toast({
|
|
249
256
|
message: 'JSON 语法错误'
|
|
250
257
|
})
|
|
251
258
|
return
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<q-icon
|
|
6
6
|
:name="icon"
|
|
7
7
|
color="grey-5"
|
|
8
|
-
:size="
|
|
8
|
+
:size="toPx(iconSize)"
|
|
9
9
|
/>
|
|
10
10
|
|
|
11
11
|
<!-- 描述文字 -->
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script>
|
|
17
|
+
import $n_px from '@netang/utils/px'
|
|
18
|
+
|
|
17
19
|
export default {
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -38,5 +40,18 @@ export default {
|
|
|
38
40
|
// 描述文字
|
|
39
41
|
description: String,
|
|
40
42
|
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 组合式
|
|
46
|
+
*/
|
|
47
|
+
setup() {
|
|
48
|
+
|
|
49
|
+
// ==========【方法】=============================================================================================
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
// 转像素
|
|
53
|
+
toPx: $n_px,
|
|
54
|
+
}
|
|
55
|
+
}
|
|
41
56
|
}
|
|
42
57
|
</script>
|