sadais-piui 1.2.2-beta1 → 1.2.2-beta2
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.
|
@@ -127,6 +127,12 @@ export default {
|
|
|
127
127
|
validator: function(value) {
|
|
128
128
|
return ['line', 'line-circle', 'fill', 'fill-circle'].includes(value)
|
|
129
129
|
}
|
|
130
|
+
},
|
|
131
|
+
// 能否取消选中状态
|
|
132
|
+
canCancel: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
// false
|
|
135
|
+
default: radio.canCancel
|
|
130
136
|
}
|
|
131
137
|
},
|
|
132
138
|
data() {
|
|
@@ -172,6 +178,9 @@ export default {
|
|
|
172
178
|
? this.$pi.common.addUnit(this.inheritProps.iconSize)
|
|
173
179
|
: this.$pi.common.addUnit(this.iconSize)
|
|
174
180
|
},
|
|
181
|
+
getCanCancel() {
|
|
182
|
+
return this.inheritProps.canCancel !== null ? this.inheritProps.canCancel : this.canCancel
|
|
183
|
+
},
|
|
175
184
|
radioStyle() {
|
|
176
185
|
const style = {
|
|
177
186
|
width: this.getSize,
|
|
@@ -37,7 +37,8 @@ export default {
|
|
|
37
37
|
'size',
|
|
38
38
|
'iconSize',
|
|
39
39
|
'activeColor',
|
|
40
|
-
'activeMode'
|
|
40
|
+
'activeMode',
|
|
41
|
+
'canCancel'
|
|
41
42
|
])
|
|
42
43
|
], // 注入value与val,进行双向绑定
|
|
43
44
|
options: {
|
|
@@ -137,6 +138,12 @@ export default {
|
|
|
137
138
|
validator: function(value) {
|
|
138
139
|
return ['', 'line', 'line-circle', 'fill', 'fill-circle'].includes(value)
|
|
139
140
|
}
|
|
141
|
+
},
|
|
142
|
+
// 能否取消选中状态
|
|
143
|
+
canCancel: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
// null
|
|
146
|
+
default: radioGroup.canCancel
|
|
140
147
|
}
|
|
141
148
|
},
|
|
142
149
|
methods: {
|
|
@@ -146,7 +153,19 @@ export default {
|
|
|
146
153
|
* @arg pi-radio的name属性值
|
|
147
154
|
*/
|
|
148
155
|
emitChange(childName) {
|
|
149
|
-
|
|
156
|
+
let canCancel = this.canCancel
|
|
157
|
+
if (!canCancel) {
|
|
158
|
+
this._children.forEach(child => {
|
|
159
|
+
if (child.name === childName) {
|
|
160
|
+
canCancel = child.getCanCancel
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
if (canCancel && this.val === childName) {
|
|
165
|
+
this.val = ''
|
|
166
|
+
} else {
|
|
167
|
+
this.val = childName
|
|
168
|
+
}
|
|
150
169
|
this.handleEmitChange()
|
|
151
170
|
}
|
|
152
171
|
}
|
package/config/radio.js
CHANGED
package/config/radioGroup.js
CHANGED