新年的第一次提交
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import type { App } from "vue";
|
||||
import Component from "./index.vue";
|
||||
import type { IDefineComponent } from "../../types/index";
|
||||
|
||||
Component.install = (app: App) => {
|
||||
app.component(Component.name || "LayRadio ", Component);
|
||||
app.component(Component.name, Component);
|
||||
};
|
||||
|
||||
export default Component as IDefineComponent;
|
||||
export default Component;
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: "LayRadio"
|
||||
}
|
||||
</script>
|
||||
|
||||
<script setup 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>
|
||||
|
||||
<template>
|
||||
<span>
|
||||
<input type="radio" :value="label" :name="name" />
|
||||
@@ -22,25 +49,4 @@
|
||||
<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>
|
||||
</template>
|
||||
Reference in New Issue
Block a user