@netang/quasar 0.0.30 → 0.0.31
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.
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!-- 默认插槽 -->
|
|
3
|
+
<slot
|
|
4
|
+
:name="currentSlot.defaultName"
|
|
5
|
+
v-if="!! currentSlot.defaultName"
|
|
6
|
+
/>
|
|
7
|
+
|
|
8
|
+
<!-- 拆分器 -->
|
|
9
|
+
<q-splitter
|
|
10
|
+
v-model="currentValue"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
v-else
|
|
13
|
+
>
|
|
14
|
+
<!-- 插槽 -->
|
|
15
|
+
<template
|
|
16
|
+
v-for="slotName in currentSlot.keys"
|
|
17
|
+
v-slot:[slotName]
|
|
18
|
+
>
|
|
19
|
+
<slot :name="slotName" />
|
|
20
|
+
</template>
|
|
21
|
+
</q-splitter>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
import { computed, ref, watch } from 'vue'
|
|
26
|
+
|
|
27
|
+
export default {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 标识
|
|
31
|
+
*/
|
|
32
|
+
name: 'NSplitter',
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 声明属性
|
|
36
|
+
*/
|
|
37
|
+
props: {
|
|
38
|
+
// 值
|
|
39
|
+
modelValue: {
|
|
40
|
+
type: Number,
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 声明事件
|
|
47
|
+
*/
|
|
48
|
+
emits: [
|
|
49
|
+
'update:modelValue',
|
|
50
|
+
],
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 组合式
|
|
54
|
+
*/
|
|
55
|
+
setup(props, { emit, slots }) {
|
|
56
|
+
|
|
57
|
+
// ==========【计算属性】=========================================================================================
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 当前插槽
|
|
61
|
+
*/
|
|
62
|
+
const currentSlot = computed(function() {
|
|
63
|
+
|
|
64
|
+
let keys = []
|
|
65
|
+
let defaultName = ''
|
|
66
|
+
|
|
67
|
+
if (utils.isValidObject(slots)) {
|
|
68
|
+
|
|
69
|
+
keys = Object.keys(slots)
|
|
70
|
+
|
|
71
|
+
const hasBefore = _.has(slots, 'before')
|
|
72
|
+
const hasAfter = _.has(slots, 'after')
|
|
73
|
+
|
|
74
|
+
if (hasBefore) {
|
|
75
|
+
if (! hasAfter) {
|
|
76
|
+
defaultName = 'before'
|
|
77
|
+
}
|
|
78
|
+
} else if (hasAfter && ! hasBefore) {
|
|
79
|
+
defaultName = 'after'
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
keys,
|
|
85
|
+
defaultName,
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// ==========【数据】============================================================================================
|
|
90
|
+
|
|
91
|
+
// 当前值
|
|
92
|
+
const currentValue = ref(props.modelValue)
|
|
93
|
+
|
|
94
|
+
// ==========【监听数据】=========================================================================================
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 监听声明值
|
|
98
|
+
*/
|
|
99
|
+
watch(()=>props.modelValue, function (val) {
|
|
100
|
+
|
|
101
|
+
// 如果值有变化
|
|
102
|
+
if (val !== currentValue.value) {
|
|
103
|
+
|
|
104
|
+
// 更新当前值
|
|
105
|
+
currentValue.value = val
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 监听值
|
|
111
|
+
*/
|
|
112
|
+
watch(currentValue, function (val) {
|
|
113
|
+
|
|
114
|
+
// 更新值
|
|
115
|
+
emit('update:modelValue', val)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// ==========【返回】=============================================================================================
|
|
119
|
+
|
|
120
|
+
return {
|
|
121
|
+
// 当前插槽
|
|
122
|
+
currentSlot,
|
|
123
|
+
// 当前值
|
|
124
|
+
currentValue,
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
</script>
|
|
@@ -8,12 +8,15 @@
|
|
|
8
8
|
container
|
|
9
9
|
>
|
|
10
10
|
<!-- 头部 -->
|
|
11
|
-
<n-toolbar
|
|
11
|
+
<n-toolbar
|
|
12
|
+
:dense="dense"
|
|
13
|
+
header
|
|
14
|
+
/>
|
|
12
15
|
|
|
13
16
|
<!-- 左侧分类 -->
|
|
14
17
|
<n-drawer
|
|
15
18
|
:model-value="true"
|
|
16
|
-
side="
|
|
19
|
+
:side="treeSide"
|
|
17
20
|
:width="200"
|
|
18
21
|
:min-width="150"
|
|
19
22
|
bordered
|
|
@@ -75,6 +78,7 @@
|
|
|
75
78
|
@request="tableRequest"
|
|
76
79
|
flat
|
|
77
80
|
virtual-scroll
|
|
81
|
+
:dense="dense"
|
|
78
82
|
>
|
|
79
83
|
<!-- 图片 -->
|
|
80
84
|
<template
|
|
@@ -130,7 +134,7 @@
|
|
|
130
134
|
<!-- 右侧搜索 -->
|
|
131
135
|
<n-drawer
|
|
132
136
|
:model-value="true"
|
|
133
|
-
side="
|
|
137
|
+
:side="searchSide"
|
|
134
138
|
:min-width="320"
|
|
135
139
|
bordered
|
|
136
140
|
drag
|
|
@@ -187,6 +191,21 @@ export default {
|
|
|
187
191
|
treeFilter: Boolean,
|
|
188
192
|
// 不显示搜索
|
|
189
193
|
noSearch: Boolean,
|
|
194
|
+
// 树位置
|
|
195
|
+
treeSide: {
|
|
196
|
+
type: String,
|
|
197
|
+
default: 'left',
|
|
198
|
+
},
|
|
199
|
+
// 搜索位置
|
|
200
|
+
searchSide: {
|
|
201
|
+
type: String,
|
|
202
|
+
default: 'right',
|
|
203
|
+
},
|
|
204
|
+
// 紧凑模式
|
|
205
|
+
dense: {
|
|
206
|
+
type: Boolean,
|
|
207
|
+
default: true,
|
|
208
|
+
},
|
|
190
209
|
},
|
|
191
210
|
|
|
192
211
|
/**
|
package/package.json
CHANGED
package/sass/quasar/table.scss
CHANGED
package/utils/price.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 换算金额
|
|
3
|
-
*/
|
|
4
|
-
utils.price = function(value, params) {
|
|
5
|
-
return utils.decimal(value, Object.assign({
|
|
6
|
-
// 最小值
|
|
7
|
-
min: 0,
|
|
8
|
-
// 小数点位数
|
|
9
|
-
decimalLength: 2,
|
|
10
|
-
// 是否开启人民币分转元(如值 189 -> 1.89)
|
|
11
|
-
centToYuan: utils.config('priceCent') === true,
|
|
12
|
-
}, params))
|
|
13
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* 换算金额
|
|
3
|
+
*/
|
|
4
|
+
utils.price = function(value, params) {
|
|
5
|
+
return utils.decimal(value, Object.assign({
|
|
6
|
+
// 最小值
|
|
7
|
+
min: 0,
|
|
8
|
+
// 小数点位数
|
|
9
|
+
decimalLength: 2,
|
|
10
|
+
// 是否开启人民币分转元(如值 189 -> 1.89)
|
|
11
|
+
centToYuan: utils.config('priceCent') === true,
|
|
12
|
+
}, params))
|
|
13
|
+
}
|