mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
Merge branch 'master' into add_switch_animation
This commit is contained in:
commit
1417f22c3b
@ -1,3 +1,3 @@
|
|||||||
import RadioGroup from '../cell/src/radio-group';
|
import RadioGroup from 'packages/radio/src/radio-group';
|
||||||
|
|
||||||
export default RadioGroup;
|
export default RadioGroup;
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
name: 'z-radio-group',
|
||||||
|
|
||||||
|
props: {
|
||||||
|
value: [String, Number]
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -4,6 +4,10 @@
|
|||||||
:class="{
|
:class="{
|
||||||
'is-disabled': disabled
|
'is-disabled': disabled
|
||||||
}">
|
}">
|
||||||
|
<span class="z-radio__input">
|
||||||
|
<input type="radio" class="z-radio__control">
|
||||||
|
<span class="z-radio__circle"></span>
|
||||||
|
</span>
|
||||||
<span class="z-radio__label">
|
<span class="z-radio__label">
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</span>
|
</span>
|
||||||
@ -22,10 +26,37 @@ export default {
|
|||||||
|
|
||||||
props: {
|
props: {
|
||||||
disabled: Boolean,
|
disabled: Boolean,
|
||||||
value: {}
|
value: {},
|
||||||
|
parentGroup: null
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
computed: {
|
||||||
|
isGroup() {
|
||||||
|
let parent = this.$parent;
|
||||||
|
while (parent) {
|
||||||
|
if (parent.$options.name === 'z-radio-group') {
|
||||||
|
this.parentGroup = parent;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
parent = parent.$parent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
|
||||||
|
model: {
|
||||||
|
get() {
|
||||||
|
return this.isGroup ? this.parentGroup.value : this.value;
|
||||||
|
},
|
||||||
|
|
||||||
|
set(val) {
|
||||||
|
if (this.isGroup) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.$emit('input', val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
5
packages/zanui-css/src/radio.pcss
Normal file
5
packages/zanui-css/src/radio.pcss
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
@component-namespace z {
|
||||||
|
@b radio {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -8,6 +8,7 @@ import CellGroup from '../packages/cell-group/index.js';
|
|||||||
import Popup from '../packages/popup/index.js';
|
import Popup from '../packages/popup/index.js';
|
||||||
import Dialog from '../packages/dialog/index.js';
|
import Dialog from '../packages/dialog/index.js';
|
||||||
import Picker from '../packages/picker/index.js';
|
import Picker from '../packages/picker/index.js';
|
||||||
|
import RadioGroup from '../packages/radio-group/index.js';
|
||||||
// zanui
|
// zanui
|
||||||
import '../packages/zanui-css/src/index.pcss';
|
import '../packages/zanui-css/src/index.pcss';
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ const install = function(Vue) {
|
|||||||
Vue.component(CellGroup.name, CellGroup);
|
Vue.component(CellGroup.name, CellGroup);
|
||||||
Vue.component(Popup.name, Popup);
|
Vue.component(Popup.name, Popup);
|
||||||
Vue.component(Picker.name, Picker);
|
Vue.component(Picker.name, Picker);
|
||||||
|
Vue.component(RadioGroup.name, RadioGroup);
|
||||||
};
|
};
|
||||||
|
|
||||||
// auto install
|
// auto install
|
||||||
@ -42,5 +44,6 @@ module.exports = {
|
|||||||
CellGroup,
|
CellGroup,
|
||||||
Popup,
|
Popup,
|
||||||
Dialog,
|
Dialog,
|
||||||
Picker
|
Picker,
|
||||||
|
RadioGroup
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user