aaa-ui-test 1.0.0
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.
Potentially problematic release.
This version of aaa-ui-test might be problematic. Click here for more details.
- package/README.md +62 -0
- package/babel-plugin-on-demand-load/index.js +74 -0
- package/babel-plugin-on-demand-load/report.js +49 -0
- package/lib/index.css +2213 -0
- package/lib/index.js +10083 -0
- package/package.json +73 -0
- package/src/assets/css/common/_mixin.scss +130 -0
- package/src/assets/css/common/_var.scss +69 -0
- package/src/components/address/index.js +8 -0
- package/src/components/address/index.scss +72 -0
- package/src/components/address/src/address.vue +238 -0
- package/src/components/amount/index.js +6 -0
- package/src/components/amount/index.scss +88 -0
- package/src/components/amount/src/amount.vue +143 -0
- package/src/components/button/__tests__/__snapshots__/index.test.js.snap +7 -0
- package/src/components/button/__tests__/index.test.js +39 -0
- package/src/components/button/index.js +7 -0
- package/src/components/button/index.scss +83 -0
- package/src/components/button/src/button.vue +39 -0
- package/src/components/button-group/index.js +8 -0
- package/src/components/button-group/index.scss +37 -0
- package/src/components/button-group/src/button-group.vue +21 -0
- package/src/components/checkbox/index.js +8 -0
- package/src/components/checkbox/index.scss +47 -0
- package/src/components/checkbox/src/checkbox-group.vue +53 -0
- package/src/components/checkbox/src/checkbox.vue +153 -0
- package/src/components/date-selecter/index.js +6 -0
- package/src/components/date-selecter/index.scss +190 -0
- package/src/components/date-selecter/src/dateselecter.vue +387 -0
- package/src/components/default/index.js +6 -0
- package/src/components/default/index.scss +25 -0
- package/src/components/default/src/default.vue +23 -0
- package/src/components/dialog/index.js +146 -0
- package/src/components/dialog/index.scss +250 -0
- package/src/components/dialog/src/dialog.vue +153 -0
- package/src/components/field/index.js +8 -0
- package/src/components/field/index.scss +93 -0
- package/src/components/field/src/field.vue +57 -0
- package/src/components/input/__tests__/__snapshots__/index.test.js.snap +10 -0
- package/src/components/input/__tests__/index.test.js +63 -0
- package/src/components/input/index.js +8 -0
- package/src/components/input/index.scss +91 -0
- package/src/components/input/src/input.vue +214 -0
- package/src/components/list/index.js +8 -0
- package/src/components/list/index.scss +21 -0
- package/src/components/list/src/list.vue +16 -0
- package/src/components/list-item/index.js +8 -0
- package/src/components/list-item/index.scss +126 -0
- package/src/components/list-item/src/list-item.vue +59 -0
- package/src/components/loading/__tests__/__snapshots__/index.test.js.snap +9 -0
- package/src/components/loading/__tests__/index.test.js +30 -0
- package/src/components/loading/index.js +128 -0
- package/src/components/loading/index.scss +33 -0
- package/src/components/loading/src/loading.vue +23 -0
- package/src/components/mask/index.js +9 -0
- package/src/components/mask/index.scss +16 -0
- package/src/components/mask/src/mask.vue +52 -0
- package/src/components/notice/index.js +6 -0
- package/src/components/notice/index.scss +81 -0
- package/src/components/notice/src/notice.vue +128 -0
- package/src/components/overlay/index.js +8 -0
- package/src/components/overlay/index.scss +119 -0
- package/src/components/overlay/src/overlay.vue +72 -0
- package/src/components/picker/index.js +7 -0
- package/src/components/picker/index.scss +49 -0
- package/src/components/picker/src/picker.vue +205 -0
- package/src/components/popup/index.js +8 -0
- package/src/components/popup/index.scss +79 -0
- package/src/components/popup/src/popup.vue +88 -0
- package/src/components/popup-header/index.js +8 -0
- package/src/components/popup-header/index.scss +45 -0
- package/src/components/popup-header/src/popup-header.vue +41 -0
- package/src/components/radio/index.js +8 -0
- package/src/components/radio/index.scss +19 -0
- package/src/components/radio/src/radio.vue +51 -0
- package/src/components/select/index.js +8 -0
- package/src/components/select/index.scss +51 -0
- package/src/components/select/src/select.vue +86 -0
- package/src/components/swiper/index.js +6 -0
- package/src/components/swiper/index.scss +49 -0
- package/src/components/swiper/src/swiper.vue +211 -0
- package/src/components/switch/__tests__/__snapshots__/index.test.js.snap +15 -0
- package/src/components/switch/__tests__/index.test.js +44 -0
- package/src/components/switch/index.js +8 -0
- package/src/components/switch/index.scss +85 -0
- package/src/components/switch/src/switch.vue +60 -0
- package/src/components/tabs/index.js +8 -0
- package/src/components/tabs/index.scss +73 -0
- package/src/components/tabs/src/tab-item.vue +40 -0
- package/src/components/tabs/src/tabs.vue +121 -0
- package/src/components/textarea/index.js +8 -0
- package/src/components/textarea/index.scss +41 -0
- package/src/components/textarea/src/textarea.vue +140 -0
- package/src/components/toast/__tests__/__snapshots__/index.test.js.snap +3 -0
- package/src/components/toast/__tests__/index.test.js +25 -0
- package/src/components/toast/index.js +53 -0
- package/src/components/toast/index.scss +102 -0
- package/src/components/toast/src/toast.vue +19 -0
- package/src/index.js +87 -0
- package/src/mixins/emitter.js +33 -0
- package/src/mixins/visible.js +23 -0
- package/src/utils/clickoutside.js +42 -0
- package/src/utils/fix-body.js +46 -0
- package/src/utils/utils.js +71 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jdd-amount-wrap">
|
|
3
|
+
<span class="jdd-amount-icon">¥</span>
|
|
4
|
+
<p :class="[{'jdd-amount-hasvalue':hasValue},'jdd-amount-edit']" @click="onClick">
|
|
5
|
+
<span class="jdd-amount-value">{{getValue}}</span>
|
|
6
|
+
<span class="jdd-amount-shine" v-show="focus"></span>
|
|
7
|
+
<div class="jdd-amount-unit-wrap" v-show="getUnit" :style="{'left':left+'px'}"><span class="jdd-amount-line"></span><span class="jdd-amount-unit">{{getUnit}}</span></div>
|
|
8
|
+
<span class="jdd-amount-slot">
|
|
9
|
+
<slot></slot>
|
|
10
|
+
</span>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: "JddAmount",
|
|
16
|
+
props: {
|
|
17
|
+
value: {},
|
|
18
|
+
showUnit: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
placeholder: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "请输入金额"
|
|
25
|
+
},
|
|
26
|
+
focus: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
inject: {
|
|
32
|
+
handleCheck: {
|
|
33
|
+
default: "itemSelect"
|
|
34
|
+
},
|
|
35
|
+
parent: {
|
|
36
|
+
default: null
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
data() {
|
|
40
|
+
return {
|
|
41
|
+
checkValue: this.value,
|
|
42
|
+
validateStatus: true,
|
|
43
|
+
label: this.title,
|
|
44
|
+
left:0
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
created() {
|
|
48
|
+
if (this.isGroup()) {
|
|
49
|
+
this.checkValue = this.parent.value;
|
|
50
|
+
} else {
|
|
51
|
+
this.checkValue = this.value;
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
computed: {
|
|
55
|
+
getUnit() {
|
|
56
|
+
let unit = "";
|
|
57
|
+
if (this.showUnit) {
|
|
58
|
+
if (this.value >= 100000&& this.value < 1000000) {
|
|
59
|
+
unit = "十万";
|
|
60
|
+
} else if (this.value >= 10000 && this.value < 100000) {
|
|
61
|
+
unit = "万";
|
|
62
|
+
} else if (this.value >= 1000 && this.value < 10000) {
|
|
63
|
+
unit = "千";
|
|
64
|
+
} else if (this.value >= 100 && this.value < 1000) {
|
|
65
|
+
unit = "百";
|
|
66
|
+
} else if (this.value >= 1000000 && this.value < 10000000){
|
|
67
|
+
unit = "百万";
|
|
68
|
+
} else if (this.value >= 10000000 && this.value < 100000000){
|
|
69
|
+
unit = "千万";
|
|
70
|
+
} else if (this.value >= 10000000 ){
|
|
71
|
+
unit = "亿";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return unit;
|
|
75
|
+
},
|
|
76
|
+
getFillColor() {
|
|
77
|
+
let finalStyle = "";
|
|
78
|
+
if (!this.disabled && !this.isChecked) {
|
|
79
|
+
return this.fillColor;
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
isChecked() {
|
|
83
|
+
if (this.isGroup()) {
|
|
84
|
+
return this.name === this.parent.value;
|
|
85
|
+
} else {
|
|
86
|
+
return this.checkValue;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
getValue() {
|
|
90
|
+
return this.focus
|
|
91
|
+
? this.value
|
|
92
|
+
: this.value || this.value === 0
|
|
93
|
+
? this.value
|
|
94
|
+
: this.placeholder;
|
|
95
|
+
// return this.value|| this.value===0?this.value:this.placeholder;
|
|
96
|
+
},
|
|
97
|
+
hasValue() {
|
|
98
|
+
return this.value || this.value === 0 || this.focus;
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
methods: {
|
|
102
|
+
onClick() {
|
|
103
|
+
this.$emit("update:focus", true);
|
|
104
|
+
this.$emit("click");
|
|
105
|
+
},
|
|
106
|
+
isGroup() {
|
|
107
|
+
return this.parent ? true : false;
|
|
108
|
+
},
|
|
109
|
+
handleChange() {
|
|
110
|
+
// if(this.isGroup()){
|
|
111
|
+
// }else{
|
|
112
|
+
// this.checkValue =
|
|
113
|
+
// }
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
watch: {
|
|
117
|
+
value(newVal) {
|
|
118
|
+
this.checkValue = newVal;
|
|
119
|
+
this.$nextTick(() => {
|
|
120
|
+
if(newVal.length ===1) {
|
|
121
|
+
this.left = document.querySelector(".jdd-amount-value").offsetLeft+document.querySelector(".jdd-amount-value").offsetWidth;
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
}
|
|
126
|
+
// "parent.value": function(newVal) {
|
|
127
|
+
// //if(this.name === newVal)
|
|
128
|
+
// this.checkValue = this.name === newVal ? true : false;
|
|
129
|
+
// },
|
|
130
|
+
// checkValue(newVal) {
|
|
131
|
+
// if (typeof this.handleCheck === "function") {
|
|
132
|
+
// if (newVal) this.handleCheck(this.name);
|
|
133
|
+
// else this.handleCheck("");
|
|
134
|
+
// } else {
|
|
135
|
+
// this.$emit("change", newVal);
|
|
136
|
+
// this.$emit("input", newVal);
|
|
137
|
+
// }
|
|
138
|
+
// }
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
</script>
|
|
142
|
+
|
|
143
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Button has been called 1`] = `<span class="jdd-button jdd-button-sick is-disabled jdd-button-large"><!----></span>`;
|
|
4
|
+
|
|
5
|
+
exports[`Button rander sick correct 1`] = `<span class="jdd-button jdd-button-sick jdd-button-large"><!----></span>`;
|
|
6
|
+
|
|
7
|
+
exports[`Button renders the correct markup 1`] = `<span class="jdd-button jdd-button-default jdd-button-large"><!----></span>`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Import the mount() method from the test utils
|
|
2
|
+
// and the component you want to test
|
|
3
|
+
import { mount } from '@vue/test-utils'
|
|
4
|
+
import Button from '../index'
|
|
5
|
+
|
|
6
|
+
describe('Button', () => {
|
|
7
|
+
// Now mount the component and you have the wrapper
|
|
8
|
+
const wrapper = mount(Button)
|
|
9
|
+
const mockFn = jest.fn();
|
|
10
|
+
wrapper.vm.$on('click', mockFn);
|
|
11
|
+
|
|
12
|
+
it('renders the correct markup', () => {
|
|
13
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
14
|
+
|
|
15
|
+
})
|
|
16
|
+
it('has a span class', () => {
|
|
17
|
+
expect(wrapper.contains('span')).toBe(true)
|
|
18
|
+
expect(wrapper.classes("jdd-button")).toBe(true)
|
|
19
|
+
|
|
20
|
+
})
|
|
21
|
+
// it's also easy to check for the existence of elements
|
|
22
|
+
it('rander sick correct', () => {
|
|
23
|
+
wrapper.setProps({ type: 'sick' })
|
|
24
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
25
|
+
expect(wrapper.classes('jdd-button-sick')).toBe(true)
|
|
26
|
+
wrapper.find('span').trigger('click');
|
|
27
|
+
expect(mockFn).toBeCalled();
|
|
28
|
+
expect(mockFn).toHaveBeenCalledTimes(1)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('has been called', () => {
|
|
32
|
+
wrapper.setProps({ "disabled": true })
|
|
33
|
+
expect(wrapper.html()).toMatchSnapshot();
|
|
34
|
+
expect(wrapper.classes('is-disabled')).toBe(true)
|
|
35
|
+
wrapper.find('span').trigger('click');
|
|
36
|
+
expect(mockFn).toBeCalled();
|
|
37
|
+
expect(mockFn).toHaveBeenCalledTimes(1);
|
|
38
|
+
})
|
|
39
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
@import "~@/assets/css/common/var";
|
|
2
|
+
@import "~@/assets/css/common/mixin";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
.jdd-button{
|
|
6
|
+
display: inline-block;
|
|
7
|
+
font-family: PingFangSC-Medium;
|
|
8
|
+
text-align: center;
|
|
9
|
+
font-size: 18px;
|
|
10
|
+
color:#fff;
|
|
11
|
+
margin:0;
|
|
12
|
+
border-radius: 2px;
|
|
13
|
+
&-large{
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 50px;
|
|
16
|
+
line-height: 50px;
|
|
17
|
+
}
|
|
18
|
+
&-medium{
|
|
19
|
+
height: 50px;
|
|
20
|
+
line-height: 50px;
|
|
21
|
+
padding: 0 84px;
|
|
22
|
+
width: auto;
|
|
23
|
+
}
|
|
24
|
+
&-small{
|
|
25
|
+
height: 30px;
|
|
26
|
+
line-height: 30px;
|
|
27
|
+
font-size: 12px;
|
|
28
|
+
width: 80px;
|
|
29
|
+
border-radius: 30px;
|
|
30
|
+
background: #fff;
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
&-default{
|
|
34
|
+
background: #4D7BFE;
|
|
35
|
+
}
|
|
36
|
+
&-default:active{
|
|
37
|
+
background:#4B84E1;
|
|
38
|
+
}
|
|
39
|
+
&-disabled{
|
|
40
|
+
background: #ccc;
|
|
41
|
+
}
|
|
42
|
+
&-sick{
|
|
43
|
+
background: #B9D1F8;
|
|
44
|
+
}
|
|
45
|
+
&-short{
|
|
46
|
+
|
|
47
|
+
background: #4D7BFE;
|
|
48
|
+
&:active{
|
|
49
|
+
background:#4B84E1;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
&-white.jdd-button-large{
|
|
53
|
+
background: #fff;
|
|
54
|
+
@include jdd-border-1px(#DDDDDD,2px);
|
|
55
|
+
color: #4D7BFE;
|
|
56
|
+
}
|
|
57
|
+
&-white.jdd-button-small{
|
|
58
|
+
background: #fff;
|
|
59
|
+
@include jdd-border-1px(#CCC,15px);
|
|
60
|
+
}
|
|
61
|
+
&-white:active{
|
|
62
|
+
background:#f2f2f2;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-white-normal.jdd-button-large{
|
|
66
|
+
background: #fff;
|
|
67
|
+
@include jdd-border-1px(#DDDDDD,2px);
|
|
68
|
+
color: #666;
|
|
69
|
+
}
|
|
70
|
+
&-white-normal.jdd-button-small{
|
|
71
|
+
background: #fff;
|
|
72
|
+
@include jdd-border-1px(#CCC,15px);
|
|
73
|
+
color: #666;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&-white-normal:active{
|
|
77
|
+
background:#f2f2f2;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
class="jdd-button"
|
|
4
|
+
@click="handleClick"
|
|
5
|
+
:class="[
|
|
6
|
+
type ? 'jdd-button-' + type : '',
|
|
7
|
+
{
|
|
8
|
+
'is-disabled': disabled
|
|
9
|
+
},
|
|
10
|
+
'jdd-button-' + size,
|
|
11
|
+
]"
|
|
12
|
+
> <span v-if="$slots.default"><slot></slot></span>
|
|
13
|
+
</span>
|
|
14
|
+
</template>
|
|
15
|
+
<script>
|
|
16
|
+
export default {
|
|
17
|
+
name: 'JddButton',
|
|
18
|
+
props: {
|
|
19
|
+
type: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'default'
|
|
22
|
+
},
|
|
23
|
+
disabled: {
|
|
24
|
+
type:Boolean,
|
|
25
|
+
default:false
|
|
26
|
+
},
|
|
27
|
+
size: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: 'large'
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
handleClick(evt) {
|
|
34
|
+
if(!this.disabled)
|
|
35
|
+
this.$emit('click', evt);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@charset "utf-8";
|
|
2
|
+
@import "~@/assets/css/common/var";
|
|
3
|
+
|
|
4
|
+
// 多按钮吸底
|
|
5
|
+
.jdd-button-group{
|
|
6
|
+
display: flex;
|
|
7
|
+
|
|
8
|
+
width: 100%;
|
|
9
|
+
font-family: PingFangSC-Medium;
|
|
10
|
+
// height: 50px;
|
|
11
|
+
// line-height: 50px;
|
|
12
|
+
font-size: 18px;
|
|
13
|
+
background: #fff;
|
|
14
|
+
color:#fff;
|
|
15
|
+
span{
|
|
16
|
+
flex:1;
|
|
17
|
+
}
|
|
18
|
+
&-bottom{
|
|
19
|
+
position: fixed;
|
|
20
|
+
bottom: 0;
|
|
21
|
+
z-index: $z-index-description;
|
|
22
|
+
padding-bottom: constant(safe-area-inset-bottom) !important;
|
|
23
|
+
padding-bottom: env(safe-area-inset-bottom) !important;
|
|
24
|
+
.jdd-button{
|
|
25
|
+
border-radius: unset;
|
|
26
|
+
}
|
|
27
|
+
.jdd-button:not(:first-child){
|
|
28
|
+
box-shadow:0 -2px 4px 0 rgba(0,0,0,0.04);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
&-top{
|
|
32
|
+
position: fixed;
|
|
33
|
+
top: 0;
|
|
34
|
+
z-index: $z-index-description
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jdd-button-group"
|
|
3
|
+
:class="[
|
|
4
|
+
type ? 'jdd-button-group-' + type : ''
|
|
5
|
+
]"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'JddButtonGroup',
|
|
14
|
+
props: {
|
|
15
|
+
type: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'default'
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Checkbox from './src/checkbox.vue';
|
|
2
|
+
import CheckboxGroup from './src/checkbox-group.vue';
|
|
3
|
+
import "./index.scss";
|
|
4
|
+
Checkbox.install = function(Vue){
|
|
5
|
+
Vue.component(Checkbox.name, Checkbox);
|
|
6
|
+
Vue.component(CheckboxGroup.name, CheckboxGroup);
|
|
7
|
+
}
|
|
8
|
+
export default Checkbox;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
.jdd-checkbox{
|
|
2
|
+
display: flex;
|
|
3
|
+
position: relative;
|
|
4
|
+
}
|
|
5
|
+
.jdd-checkbox-disabled {
|
|
6
|
+
.jdd-checkbox-icon{
|
|
7
|
+
background:rgba(221,221,221,1);
|
|
8
|
+
border:none;
|
|
9
|
+
}
|
|
10
|
+
.jdd-checkbox-label {
|
|
11
|
+
color:rgba(204,204,204,1);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
.jdd-list-item-icon .jdd-checkbox-icon {
|
|
15
|
+
margin-right: 0;
|
|
16
|
+
}
|
|
17
|
+
.jdd-checkbox-icon {
|
|
18
|
+
display: flex;
|
|
19
|
+
position: relative;
|
|
20
|
+
width: 15px;
|
|
21
|
+
height: 15px;
|
|
22
|
+
flex-shrink: 0;
|
|
23
|
+
border-radius: 100%;
|
|
24
|
+
margin-right: 6px;
|
|
25
|
+
}
|
|
26
|
+
.jdd-checkbox-input {
|
|
27
|
+
position: absolute;
|
|
28
|
+
left: 0;
|
|
29
|
+
top: 0;
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
outline: none;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
}
|
|
35
|
+
.jdd-checkbox-checked {
|
|
36
|
+
svg{
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: 100%;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
.jdd-checkbox-unchecked {
|
|
42
|
+
border-width: 1px;
|
|
43
|
+
border-style: solid;
|
|
44
|
+
svg{
|
|
45
|
+
display: none;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jdd-checkbox-list">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: "JddCheckboxGroup",
|
|
10
|
+
props: {
|
|
11
|
+
value: {
|
|
12
|
+
default: 0
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
provide() {
|
|
16
|
+
return {
|
|
17
|
+
handleCheck: this.boxChecked,
|
|
18
|
+
parent:this
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
checkValue:this.value
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
created() {
|
|
27
|
+
let slotsLength = 0;
|
|
28
|
+
if(this.$slots.default&&this.$slots.default.length){
|
|
29
|
+
slotsLength = this.$slots.default.length;
|
|
30
|
+
}
|
|
31
|
+
if(slotsLength >= 5){
|
|
32
|
+
this.needScroll = true;
|
|
33
|
+
}
|
|
34
|
+
//let slotsLength = this.$slots.default.length;
|
|
35
|
+
// console.log()
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
itemSelect(value,content) {
|
|
39
|
+
this.$emit("input",value);
|
|
40
|
+
},
|
|
41
|
+
boxChecked(check){
|
|
42
|
+
|
|
43
|
+
this.checkValue = check;
|
|
44
|
+
this.$emit("input",check);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
watch: {
|
|
48
|
+
value(newVal){
|
|
49
|
+
this.checkValue = newVal;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="jdd-checkbox-wrap">
|
|
3
|
+
<label for :class="['jdd-checkbox',disabled?'jdd-checkbox-disabled':'']" @click = "check">
|
|
4
|
+
<span
|
|
5
|
+
class="jdd-checkbox-icon"
|
|
6
|
+
:style="{'borderColor':getFillColor}"
|
|
7
|
+
:class="[isChecked?'jdd-checkbox-checked':'jdd-checkbox-unchecked']"
|
|
8
|
+
>
|
|
9
|
+
<svg
|
|
10
|
+
t="1575962492834"
|
|
11
|
+
viewBox="0 0 1024 1024"
|
|
12
|
+
version="1.1"
|
|
13
|
+
p-id="2415"
|
|
14
|
+
data-spm-anchor-id="a313x.7781069.0.i17"
|
|
15
|
+
>
|
|
16
|
+
<path
|
|
17
|
+
d="M512 0C228.430769 0 0 228.430769 0 512s228.430769 512 512 512 512-228.430769 512-512S795.569231 0 512 0z m256 413.538462l-271.753846 271.753846c-7.876923 7.876923-19.692308 11.815385-31.507692 11.815384-11.815385 0-23.630769-3.938462-31.507693-11.815384l-169.353846-169.353846c-15.753846-15.753846-15.753846-47.261538 0-63.015385 15.753846-15.753846 47.261538-15.753846 63.015385 0l137.846154 137.846154 240.246153-240.246154c15.753846-15.753846 47.261538-15.753846 63.015385 0 19.692308 15.753846 19.692308 47.261538 0 63.015385z"
|
|
18
|
+
p-id="2416"
|
|
19
|
+
:fill="fillColor"
|
|
20
|
+
/>
|
|
21
|
+
</svg>
|
|
22
|
+
<input type="checkbox" class="jdd-checkbox-input" v-model="getValue" :disabled="disabled" @change="handleChange"/>
|
|
23
|
+
</span>
|
|
24
|
+
|
|
25
|
+
<span class="jdd-checkbox-label">
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</span>
|
|
28
|
+
</label>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
<script>
|
|
32
|
+
export default {
|
|
33
|
+
name: "JddCheckbox",
|
|
34
|
+
props: {
|
|
35
|
+
value: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
fillColor: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "#4D7BFE"
|
|
46
|
+
},
|
|
47
|
+
name: {
|
|
48
|
+
default: undefined
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
inject: {
|
|
52
|
+
handleCheck: {
|
|
53
|
+
default: "itemSelect"
|
|
54
|
+
},
|
|
55
|
+
parent: {
|
|
56
|
+
default: null
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
checkValue: this.value,
|
|
62
|
+
validateStatus: true,
|
|
63
|
+
label: this.title
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
created() {
|
|
67
|
+
if (this.isGroup()) {
|
|
68
|
+
this.checkValue = this.parent.value;
|
|
69
|
+
} else {
|
|
70
|
+
this.checkValue = this.value;
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
computed: {
|
|
74
|
+
getFillColor() {
|
|
75
|
+
let finalStyle = "";
|
|
76
|
+
if (!this.disabled && !this.isChecked) {
|
|
77
|
+
return this.fillColor;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
isChecked() {
|
|
81
|
+
if (this.isGroup()) {
|
|
82
|
+
return this.name === this.parent.value;
|
|
83
|
+
} else {
|
|
84
|
+
return this.checkValue;
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
getValue:{
|
|
88
|
+
get(){
|
|
89
|
+
if(this.isGroup()){
|
|
90
|
+
return this.parent.value;
|
|
91
|
+
}else{
|
|
92
|
+
return this.checkValue
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
set(newVal){
|
|
96
|
+
|
|
97
|
+
if(this.isGroup()){
|
|
98
|
+
|
|
99
|
+
this.handleCheck(this.name);
|
|
100
|
+
// else this.handleCheck("");
|
|
101
|
+
}else{
|
|
102
|
+
this.$emit("change", newVal);
|
|
103
|
+
this.$emit("input", newVal);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
check(target) {
|
|
110
|
+
if(target.target.tagName !== 'A' && !this.disabled){
|
|
111
|
+
if(this.isGroup()){
|
|
112
|
+
|
|
113
|
+
this.handleCheck(this.name);
|
|
114
|
+
// else this.handleCheck("");
|
|
115
|
+
}else{
|
|
116
|
+
this.$emit("change", !this.checkValue);
|
|
117
|
+
this.$emit("input", !this.checkValue);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
isGroup() {
|
|
122
|
+
return this.parent ? true : false;
|
|
123
|
+
},
|
|
124
|
+
handleChange(){
|
|
125
|
+
// if(this.isGroup()){
|
|
126
|
+
|
|
127
|
+
// }else{
|
|
128
|
+
// this.checkValue =
|
|
129
|
+
// }
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
watch: {
|
|
133
|
+
value(newVal) {
|
|
134
|
+
this.checkValue = newVal;
|
|
135
|
+
},
|
|
136
|
+
// "parent.value": function(newVal) {
|
|
137
|
+
// //if(this.name === newVal)
|
|
138
|
+
// this.checkValue = this.name === newVal ? true : false;
|
|
139
|
+
// },
|
|
140
|
+
// checkValue(newVal) {
|
|
141
|
+
// if (typeof this.handleCheck === "function") {
|
|
142
|
+
// if (newVal) this.handleCheck(this.name);
|
|
143
|
+
// else this.handleCheck("");
|
|
144
|
+
// } else {
|
|
145
|
+
// this.$emit("change", newVal);
|
|
146
|
+
// this.$emit("input", newVal);
|
|
147
|
+
// }
|
|
148
|
+
// }
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
|