widget.qw 1.0.83 → 1.0.85
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/.env.development +10 -10
- package/.env.production +8 -8
- package/README.md +75 -75
- package/build/style.css +521 -471
- package/build/widget.qw.es.js +253 -84
- package/build/widget.qw.umd.js +252 -83
- package/index.html +17 -17
- package/package.json +47 -47
- package/src/App.vue +26 -26
- package/src/api/index.js +173 -165
- package/src/components/AuditBar.vue +396 -396
- package/src/components/BillCard.vue +164 -164
- package/src/components/CascaderPicker.vue +132 -132
- package/src/components/CascaderPop.vue +375 -371
- package/src/components/CheckGroup.vue +113 -113
- package/src/components/DatetimeDropdown.vue +62 -0
- package/src/components/{DatetimePicker/index.vue → DatetimePicker.vue} +124 -124
- package/src/components/DayDropdown.vue +56 -56
- package/src/components/FilePicker.vue +169 -169
- package/src/components/HeadBar.vue +130 -0
- package/src/components/Input.vue +80 -80
- package/src/components/MonthDropdown.vue +51 -51
- package/src/components/MultiPicker.vue +123 -123
- package/src/components/ObjsEditor.vue +334 -334
- package/src/components/SecretNotify.js +5 -5
- package/src/components/Sheet.vue +92 -92
- package/src/components/SingleApiPicker.vue +108 -108
- package/src/components/SinglePicker.vue +102 -102
- package/src/components/SingleUserSelector.vue +425 -425
- package/src/components/Switch.vue +64 -64
- package/src/components/TreePicker.vue +113 -113
- package/src/components/UserPicker.vue +106 -106
- package/src/components/UserProfile.vue +129 -129
- package/src/components/UsersPicker.vue +118 -118
- package/src/components/YearDropdown.vue +59 -59
- package/src/components/data_selector.vue +303 -303
- package/src/components/image_picker.vue +123 -123
- package/src/components/images_picker.vue +195 -195
- package/src/components/index.js +172 -162
- package/src/components/mult_list_selector.vue +155 -155
- package/src/components/subdepartment_selector.vue +481 -481
- package/src/components/user_selector.vue +639 -639
- package/src/components/widget/DataPop.vue +95 -95
- package/src/components/{DatetimePicker → widget}/DatetimePop.vue +342 -342
- package/src/components/widget/TreePop.vue +88 -88
- package/src/components/widget/UserPop.vue +347 -347
- package/src/main.js +117 -117
- package/src/router/index.ts +183 -173
- package/src/util/array_util.js +32 -32
- package/src/util/auth_util.js +72 -72
- package/src/util/bool_util.js +5 -5
- package/src/util/bus.js +1 -1
- package/src/util/cache_util.js +18 -18
- package/src/util/errer_code.js +6 -6
- package/src/util/eval_util.js +19 -19
- package/src/util/icon_util.js +36 -36
- package/src/util/image_util.js +27 -27
- package/src/util/index.js +57 -57
- package/src/util/num_util.js +70 -70
- package/src/util/obj_util.js +28 -28
- package/src/util/request.js +73 -73
- package/src/util/request_json.js +71 -71
- package/src/util/request_json_mute.js +65 -65
- package/src/util/request_upload.js +79 -79
- package/src/util/route_util.js +31 -31
- package/src/util/str_util.js +143 -143
- package/src/util/time_util.js +406 -406
- package/src/util/toast_util.js +24 -24
- package/src/util/tree_util.js +153 -153
- package/src/util/uuid_util.js +9 -9
- package/src/util/validate.js +182 -182
- package/src/util/vue_filter.js +223 -223
- package/src/views/auditbar/index.vue +78 -78
- package/src/views/billcard/index.vue +48 -48
- package/src/views/cascaderpicker/index.vue +0 -0
- package/src/views/cascaderpicker/userpicker.vue +183 -0
- package/src/views/cascaderpop/index.vue +90 -90
- package/src/views/checkgroup/index.vue +35 -35
- package/src/views/dataSelector/index.vue +48 -48
- package/src/views/datetimedropdown/index.vue +34 -0
- package/src/views/datetimepicker/index.vue +34 -34
- package/src/views/daydropdown/index.vue +31 -31
- package/src/views/filepicker/index.vue +32 -32
- package/src/views/headbar/index.vue +28 -0
- package/src/views/home/index.vue +0 -0
- package/src/views/imagepicker/index.vue +31 -31
- package/src/views/imagespicker/index.vue +37 -37
- package/src/views/input/index.vue +35 -35
- package/src/views/monthdropdown/index.vue +31 -31
- package/src/views/multListSelector/index.vue +61 -61
- package/src/views/multipicker/index.vue +36 -36
- package/src/views/objseditor/index.vue +277 -277
- package/src/views/productSelector/index.vue +35 -35
- package/src/views/projectpicker/index.vue +41 -41
- package/src/views/secretnotify/index.vue +27 -27
- package/src/views/sheet/index.vue +45 -45
- package/src/views/singlepicker/index.vue +35 -35
- package/src/views/subdepartmentSelector/index.vue +40 -40
- package/src/views/switch/index.vue +34 -34
- package/src/views/treepicker/index.vue +41 -41
- package/src/views/userSelector/index.vue +54 -54
- package/src/views/userSelectorNew/index.vue +45 -45
- package/src/views/userpicker/index.vue +43 -43
- package/src/views/userprofile/index.vue +30 -30
- package/src/views/userspicker/index.vue +43 -43
- package/src/views/yeardropdown/index.vue +32 -32
- package/src/vm/index.js +1 -1
- package/vite.config.ts +122 -122
package/src/components/index.js
CHANGED
|
@@ -1,162 +1,172 @@
|
|
|
1
|
-
// 引入封装好的组件
|
|
2
|
-
import vm from "../vm";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
1
|
+
// 引入封装好的组件
|
|
2
|
+
import vm from "../vm";
|
|
3
|
+
import HeadBar from "./HeadBar.vue";
|
|
4
|
+
import AuditBar from "./AuditBar.vue";
|
|
5
|
+
import Input from "./Input.vue";
|
|
6
|
+
import SinglePicker from "./SinglePicker.vue";
|
|
7
|
+
import MultiPicker from './MultiPicker.vue'
|
|
8
|
+
import CheckGroup from "./CheckGroup.vue";
|
|
9
|
+
import DatetimePicker from "./DatetimePicker.vue";
|
|
10
|
+
import DatetimeDropdown from "./DatetimeDropdown.vue";
|
|
11
|
+
import DataSelector from "./data_selector.vue";
|
|
12
|
+
import MultListSelector from "./mult_list_selector.vue";
|
|
13
|
+
import SubdepartmentSelector from "./subdepartment_selector.vue";
|
|
14
|
+
import UserSelector from "./user_selector.vue";
|
|
15
|
+
import ImagePicker from "./image_picker.vue";
|
|
16
|
+
import ImagesPicker from "./images_picker.vue";
|
|
17
|
+
import FilePicker from "./FilePicker.vue";
|
|
18
|
+
import SingleUserSelector from "./SingleUserSelector.vue";
|
|
19
|
+
import UsersPicker from "./UsersPicker.vue"
|
|
20
|
+
import UserPicker from "./UserPicker.vue"
|
|
21
|
+
import UserProfile from "./UserProfile.vue"
|
|
22
|
+
import BillCard from './BillCard.vue'
|
|
23
|
+
import YearDropdown from "./YearDropdown.vue";
|
|
24
|
+
import MonthDropdown from "./MonthDropdown.vue";
|
|
25
|
+
import DayDropdown from "./DayDropdown.vue";
|
|
26
|
+
import Switch from './Switch.vue'
|
|
27
|
+
import Sheet from './Sheet.vue'
|
|
28
|
+
import TreePicker from './TreePicker.vue'
|
|
29
|
+
import CascaderPop from './CascaderPop.vue'
|
|
30
|
+
import CascaderPicker from './CascaderPicker.vue'
|
|
31
|
+
import SingleApiPicker from "./SingleApiPicker.vue";
|
|
32
|
+
import ObjsEditor from './ObjsEditor.vue'
|
|
33
|
+
|
|
34
|
+
const components = [
|
|
35
|
+
{
|
|
36
|
+
name: "WidgetQwHeadBar",
|
|
37
|
+
widget: HeadBar,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "WidgetQwAuditBar",
|
|
41
|
+
widget: AuditBar,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "WidgetQwInput",
|
|
45
|
+
widget: Input,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "WidgetQwSinglePicker",
|
|
49
|
+
widget: SinglePicker,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: "WidgetQwMultiPicker",
|
|
53
|
+
widget: MultiPicker,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "WidgetQwCheckGroup",
|
|
57
|
+
widget: CheckGroup,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "WidgetQwDatetimePicker",
|
|
61
|
+
widget: DatetimePicker,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "WidgetQwDatetimeDropdown",
|
|
65
|
+
widget: DatetimeDropdown,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: "WidgetQwDataSelector",
|
|
69
|
+
widget: DataSelector,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "WidgetQwMultListSelector",
|
|
73
|
+
widget: MultListSelector,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "WidgetQwSubdepartmentSelector",
|
|
77
|
+
widget: SubdepartmentSelector,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: "WidgetQwSingleUserSelector",
|
|
81
|
+
widget: SingleUserSelector,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "WidgetQwImagePicker",
|
|
85
|
+
widget: ImagePicker,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "WidgetQwImagesPicker",
|
|
89
|
+
widget: ImagesPicker,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "WidgetQwFilePicker",
|
|
93
|
+
widget: FilePicker,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'WidgetQwBillCard',
|
|
97
|
+
widget: BillCard
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'WidgetQwUserSelector',
|
|
101
|
+
widget: UserSelector
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'WidgetQwUsersPicker',
|
|
105
|
+
widget: UsersPicker
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'WidgetQwUserPicker',
|
|
109
|
+
widget: UserPicker
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'WidgetQwUserProfile',
|
|
113
|
+
widget: UserProfile
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'WidgetQwYearDropdown',
|
|
117
|
+
widget: YearDropdown
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'WidgetQwMonthDropdown',
|
|
121
|
+
widget: MonthDropdown
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'WidgetQwDayDropdown',
|
|
125
|
+
widget: DayDropdown
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'WidgetQwSwitch',
|
|
129
|
+
widget: Switch
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'WidgetQwSheet',
|
|
133
|
+
widget: Sheet
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: 'WidgetQwTreePicker',
|
|
137
|
+
widget: TreePicker
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'WidgetQwCascaderPop',
|
|
141
|
+
widget: CascaderPop
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'WidgetQwCascaderPicker',
|
|
145
|
+
widget: CascaderPicker
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'WidgetQwSingleApiPicker',
|
|
149
|
+
widget: SingleApiPicker
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
name: "WidgetQwObjsEditor",
|
|
153
|
+
widget: ObjsEditor,
|
|
154
|
+
},
|
|
155
|
+
];
|
|
156
|
+
// 导出组件
|
|
157
|
+
export const WidgetQw = {
|
|
158
|
+
install(app) {
|
|
159
|
+
components.forEach((component) => {
|
|
160
|
+
app.component(component.name, component.widget);
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// 导出初始化方法
|
|
166
|
+
export function setup(params) {
|
|
167
|
+
Object.keys(params).forEach(key => {
|
|
168
|
+
vm[key] = params[key]
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export * from "./SecretNotify";
|
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- Tips section with corrected syntax -->
|
|
3
|
-
<div class="confirmation-tips" v-if="tips && tips.length > 0">
|
|
4
|
-
<van-icon name="info" color="#1989fa" />
|
|
5
|
-
<span>{{ tips }}</span>
|
|
6
|
-
</div>
|
|
7
|
-
|
|
8
|
-
<van-checkbox-group
|
|
9
|
-
:model-value="modelValue"
|
|
10
|
-
@update:model-value="$emit('update:modelValue', $event)"
|
|
11
|
-
class="confirmation-group"
|
|
12
|
-
:required="required"
|
|
13
|
-
:disabled="props.disabled"
|
|
14
|
-
:rules="rules"
|
|
15
|
-
>
|
|
16
|
-
<div class="confirmation-item" v-for="item in options" :key="item.value">
|
|
17
|
-
<van-checkbox
|
|
18
|
-
:name="item.value"
|
|
19
|
-
shape="square"
|
|
20
|
-
icon-size="18px"
|
|
21
|
-
class="custom-checkbox"
|
|
22
|
-
>
|
|
23
|
-
<span class="option-text">{{ item.label }}</span>
|
|
24
|
-
</van-checkbox>
|
|
25
|
-
</div>
|
|
26
|
-
</van-checkbox-group>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script setup>
|
|
30
|
-
import { ref, watch, nextTick } from 'vue';
|
|
31
|
-
const props = defineProps({
|
|
32
|
-
options: {
|
|
33
|
-
type: Array,
|
|
34
|
-
required: true
|
|
35
|
-
},
|
|
36
|
-
modelValue: {
|
|
37
|
-
type: Array,
|
|
38
|
-
default: () => []
|
|
39
|
-
},
|
|
40
|
-
disabled: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false
|
|
43
|
-
},
|
|
44
|
-
required: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: true
|
|
47
|
-
},
|
|
48
|
-
tips: {
|
|
49
|
-
type: String,
|
|
50
|
-
default: ''
|
|
51
|
-
},
|
|
52
|
-
rules : {
|
|
53
|
-
type: Array,
|
|
54
|
-
default: () => []
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
defineEmits(['update:modelValue']);
|
|
59
|
-
|
|
60
|
-
// watch(() => props.disabled, (newVal) => {
|
|
61
|
-
// console.log('disabled状态变化:', newVal);
|
|
62
|
-
// // 强制更新复选框状态
|
|
63
|
-
// nextTick(() => {
|
|
64
|
-
// const checkboxes = document.querySelectorAll('.van-checkbox');
|
|
65
|
-
// checkboxes.forEach(checkbox => {
|
|
66
|
-
// checkbox.style.pointerEvents = newVal ? 'none' : 'auto';
|
|
67
|
-
// checkbox.style.opacity = newVal ? '0.6' : '1';
|
|
68
|
-
// });
|
|
69
|
-
// });
|
|
70
|
-
// });
|
|
71
|
-
</script>
|
|
72
|
-
|
|
73
|
-
<style scoped>
|
|
74
|
-
/* // 修改 confirmation-group 和 confirmation-item 的样式 */
|
|
75
|
-
.confirmation-group {
|
|
76
|
-
padding: 0 16px;
|
|
77
|
-
--van-checkbox-disabled-icon-color: black;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.confirmation-item {
|
|
81
|
-
padding: 12px 16px;
|
|
82
|
-
margin: 0 -16px;
|
|
83
|
-
border-bottom: 1px solid #f5f5f5;
|
|
84
|
-
/* 禁用状态样式 */
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/* // 在下方添加媒体查询适配小屏幕 */
|
|
89
|
-
@media (max-width: 320px) {
|
|
90
|
-
.confirmation-item {
|
|
91
|
-
padding: 12px 8px;
|
|
92
|
-
margin: 0 -8px;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.confirmation-item:last-child {
|
|
97
|
-
border-bottom: none;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/* 新增样式 */
|
|
101
|
-
.confirmation-tips {
|
|
102
|
-
padding: 12px 16px;
|
|
103
|
-
background: #f0faff;
|
|
104
|
-
border-radius: 8px;
|
|
105
|
-
margin: 10px 16px;
|
|
106
|
-
display: flex;
|
|
107
|
-
align-items: center;
|
|
108
|
-
color: #1989fa;
|
|
109
|
-
font-size: 13px;
|
|
110
|
-
border: 1px solid #d9efff;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
.confirmation-tips .van-icon {
|
|
114
|
-
margin-right: 8px;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/* 新增字体继承样式 */
|
|
118
|
-
.confirmation-group {
|
|
119
|
-
font-size: inherit; /* 继承父级字体大小 */
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.option-text {
|
|
123
|
-
font-size: 14px; /* 明确指定字体大小 */
|
|
124
|
-
line-height: 1.5; /* 保持行高一致 */
|
|
125
|
-
/* color:black; */
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* 适配移动端的字体调整 */
|
|
129
|
-
@media (max-width: 375px) {
|
|
130
|
-
.option-text {
|
|
131
|
-
font-size: 13px;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/* 新增禁用状态样式 */
|
|
136
|
-
.custom-checkbox:disabled :deep(.--van-checkbox__icon) {
|
|
137
|
-
background-color: #f5f5f5;
|
|
138
|
-
border-color: #ebedf0;
|
|
139
|
-
transition: all 0.3s;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.custom-checkbox:disabled :deep(.van-checkbox__icon--checked) {
|
|
143
|
-
background-color: #1989fa;
|
|
144
|
-
border-color: #1989fa;
|
|
145
|
-
opacity: 0.7;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.van-checkbox--disabled :deep(.option-text) {
|
|
149
|
-
color: #969799;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.van-checkbox--disabled.van-checkbox--checked :deep(.option-text) {
|
|
153
|
-
color: #1989fa;
|
|
154
|
-
opacity: 0.8;
|
|
155
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<!-- Tips section with corrected syntax -->
|
|
3
|
+
<div class="confirmation-tips" v-if="tips && tips.length > 0">
|
|
4
|
+
<van-icon name="info" color="#1989fa" />
|
|
5
|
+
<span>{{ tips }}</span>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<van-checkbox-group
|
|
9
|
+
:model-value="modelValue"
|
|
10
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
11
|
+
class="confirmation-group"
|
|
12
|
+
:required="required"
|
|
13
|
+
:disabled="props.disabled"
|
|
14
|
+
:rules="rules"
|
|
15
|
+
>
|
|
16
|
+
<div class="confirmation-item" v-for="item in options" :key="item.value">
|
|
17
|
+
<van-checkbox
|
|
18
|
+
:name="item.value"
|
|
19
|
+
shape="square"
|
|
20
|
+
icon-size="18px"
|
|
21
|
+
class="custom-checkbox"
|
|
22
|
+
>
|
|
23
|
+
<span class="option-text">{{ item.label }}</span>
|
|
24
|
+
</van-checkbox>
|
|
25
|
+
</div>
|
|
26
|
+
</van-checkbox-group>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup>
|
|
30
|
+
import { ref, watch, nextTick } from 'vue';
|
|
31
|
+
const props = defineProps({
|
|
32
|
+
options: {
|
|
33
|
+
type: Array,
|
|
34
|
+
required: true
|
|
35
|
+
},
|
|
36
|
+
modelValue: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => []
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: false
|
|
43
|
+
},
|
|
44
|
+
required: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
48
|
+
tips: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: ''
|
|
51
|
+
},
|
|
52
|
+
rules : {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: () => []
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
defineEmits(['update:modelValue']);
|
|
59
|
+
|
|
60
|
+
// watch(() => props.disabled, (newVal) => {
|
|
61
|
+
// console.log('disabled状态变化:', newVal);
|
|
62
|
+
// // 强制更新复选框状态
|
|
63
|
+
// nextTick(() => {
|
|
64
|
+
// const checkboxes = document.querySelectorAll('.van-checkbox');
|
|
65
|
+
// checkboxes.forEach(checkbox => {
|
|
66
|
+
// checkbox.style.pointerEvents = newVal ? 'none' : 'auto';
|
|
67
|
+
// checkbox.style.opacity = newVal ? '0.6' : '1';
|
|
68
|
+
// });
|
|
69
|
+
// });
|
|
70
|
+
// });
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<style scoped>
|
|
74
|
+
/* // 修改 confirmation-group 和 confirmation-item 的样式 */
|
|
75
|
+
.confirmation-group {
|
|
76
|
+
padding: 0 16px;
|
|
77
|
+
--van-checkbox-disabled-icon-color: black;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.confirmation-item {
|
|
81
|
+
padding: 12px 16px;
|
|
82
|
+
margin: 0 -16px;
|
|
83
|
+
border-bottom: 1px solid #f5f5f5;
|
|
84
|
+
/* 禁用状态样式 */
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* // 在下方添加媒体查询适配小屏幕 */
|
|
89
|
+
@media (max-width: 320px) {
|
|
90
|
+
.confirmation-item {
|
|
91
|
+
padding: 12px 8px;
|
|
92
|
+
margin: 0 -8px;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.confirmation-item:last-child {
|
|
97
|
+
border-bottom: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* 新增样式 */
|
|
101
|
+
.confirmation-tips {
|
|
102
|
+
padding: 12px 16px;
|
|
103
|
+
background: #f0faff;
|
|
104
|
+
border-radius: 8px;
|
|
105
|
+
margin: 10px 16px;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
color: #1989fa;
|
|
109
|
+
font-size: 13px;
|
|
110
|
+
border: 1px solid #d9efff;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.confirmation-tips .van-icon {
|
|
114
|
+
margin-right: 8px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* 新增字体继承样式 */
|
|
118
|
+
.confirmation-group {
|
|
119
|
+
font-size: inherit; /* 继承父级字体大小 */
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.option-text {
|
|
123
|
+
font-size: 14px; /* 明确指定字体大小 */
|
|
124
|
+
line-height: 1.5; /* 保持行高一致 */
|
|
125
|
+
/* color:black; */
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* 适配移动端的字体调整 */
|
|
129
|
+
@media (max-width: 375px) {
|
|
130
|
+
.option-text {
|
|
131
|
+
font-size: 13px;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/* 新增禁用状态样式 */
|
|
136
|
+
.custom-checkbox:disabled :deep(.--van-checkbox__icon) {
|
|
137
|
+
background-color: #f5f5f5;
|
|
138
|
+
border-color: #ebedf0;
|
|
139
|
+
transition: all 0.3s;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.custom-checkbox:disabled :deep(.van-checkbox__icon--checked) {
|
|
143
|
+
background-color: #1989fa;
|
|
144
|
+
border-color: #1989fa;
|
|
145
|
+
opacity: 0.7;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.van-checkbox--disabled :deep(.option-text) {
|
|
149
|
+
color: #969799;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.van-checkbox--disabled.van-checkbox--checked :deep(.option-text) {
|
|
153
|
+
color: #1989fa;
|
|
154
|
+
opacity: 0.8;
|
|
155
|
+
}
|
|
156
156
|
</style>
|