This commit is contained in:
2022-11-14 11:56:21 +08:00
commit 0a63adba99
337 changed files with 25661 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
import { withInstall, WithInstallType } from "../../utils";
import Component from "./index.vue";
const component: WithInstallType<typeof Component> = withInstall(Component);
export default component;

View File

@@ -0,0 +1,56 @@
<script lang="ts">
export default {
name: "LayRadioGroup",
};
</script>
<script setup lang="ts">
import { provide, ref, watch } from "vue";
export interface RadioGroupProps {
modelValue?: string | boolean | number;
name?: string;
disabled?: boolean;
}
const props = withDefaults(defineProps<RadioGroupProps>(), {
disabled: false,
});
const emit = defineEmits(["update:modelValue", "change"]);
const modelValue = ref(props.modelValue);
const disabled = ref(props.disabled);
provide("radioGroup", {
name: "LayRadioGroup",
modelValue: modelValue,
naiveName: props.name,
disabled: disabled,
});
watch(
() => modelValue,
(val) => {
emit("change", modelValue.value);
emit("update:modelValue", modelValue.value);
},
{ deep: true }
);
watch(
() => props.modelValue,
(val) => (modelValue.value = val)
);
watch(
() => props.disabled,
(val) => (disabled.value = val)
);
</script>
<template>
<div class="layui-radio-group">
<slot></slot>
</div>
</template>