修复 src 结构
This commit is contained in:
9
src/component/radio/index.ts
Normal file
9
src/component/radio/index.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { App } from "vue";
|
||||
import Component from "./index.vue";
|
||||
import type { IDefineComponent } from "../type/index";
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || "LayRadio ", Component);
|
||||
};
|
||||
|
||||
export default Component as IDefineComponent;
|
||||
46
src/component/radio/index.vue
Normal file
46
src/component/radio/index.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<span>
|
||||
<input type="radio" :value="label" :name="name" />
|
||||
<div
|
||||
class="layui-unselect layui-form-radio"
|
||||
:class="{
|
||||
'layui-form-radioed': modelValue == label,
|
||||
'layui-radio-disbaled layui-disabled': disabled,
|
||||
}"
|
||||
@click.stop="handleClick"
|
||||
>
|
||||
<i
|
||||
v-if="modelValue == label"
|
||||
class="layui-anim layui-icon layui-anim-scaleSpring"
|
||||
></i
|
||||
>
|
||||
<i
|
||||
v-else
|
||||
class="layui-anim layui-icon layui-anim-scaleSpring layui-form-radioed"
|
||||
></i
|
||||
>
|
||||
<span><slot></slot></span>
|
||||
</div>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script setup name="LayRadio" lang="ts">
|
||||
import { defineProps, defineEmits } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string;
|
||||
disabled?: boolean;
|
||||
label?: string;
|
||||
name: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(["update:modelValue", "change"]);
|
||||
|
||||
const handleClick = function () {
|
||||
if (props.disabled) {
|
||||
return;
|
||||
}
|
||||
emit("change", props.label);
|
||||
emit("update:modelValue", props.label);
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user