From 2ae33353940fe41fc5433c8d20a5659c809d8c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=B1=E7=9C=A0=E5=84=80=E5=BC=8F?= <854085467@qq.com> Date: Fri, 27 May 2022 10:06:43 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(radio-group):=20=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?radio-group=20=E5=8D=95=E9=80=89=E6=8C=89=E9=92=AE=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/component/iconPicker/index.vue | 10 ++--- .../src/component/noticeBar/index.vue | 24 +++++------ .../component/src/component/radio/index.vue | 41 +++++++++++++++---- .../src/component/radioGroup/index.ts | 5 +++ .../src/component/radioGroup/index.vue | 41 +++++++++++++++++++ .../component/src/component/select/index.vue | 6 +-- package/component/src/index.ts | 3 ++ .../document/zh-CN/components/noticeBar.md | 6 +-- .../src/document/zh-CN/components/radio.md | 33 +++++++++++++++ 9 files changed, 134 insertions(+), 35 deletions(-) create mode 100644 package/component/src/component/radioGroup/index.ts create mode 100644 package/component/src/component/radioGroup/index.vue diff --git a/package/component/src/component/iconPicker/index.vue b/package/component/src/component/iconPicker/index.vue index 069b69bc..a0586ed4 100644 --- a/package/component/src/component/iconPicker/index.vue +++ b/package/component/src/component/iconPicker/index.vue @@ -9,7 +9,7 @@ import "./index.less"; import { Ref, ref } from "vue"; import { LayIconList as icons } from "@layui/icons-vue"; import LayDropdown from "../dropdown/index.vue"; -import layInput from "../input/index.vue"; +import LayInput from "../input/index.vue"; export interface LayIconPickerProps { page?: boolean; @@ -26,7 +26,7 @@ const emit = defineEmits(["update:modelValue", "change"]); const selectedIcon: Ref = ref(props.modelValue as string); const dropdownRef = ref(null); -const selectIcon = function (icon: string) { +const selectIcon = function (icon: string) : void { emit("update:modelValue", icon); emit("change", icon); selectedIcon.value = icon; @@ -34,9 +34,9 @@ const selectIcon = function (icon: string) { }; const icones: Ref = ref([]); -const total = ref(icons.length); -const totalPage = ref(total.value / 12); -const currentPage: Ref = ref(1); +const total: Ref = ref(icons.length); +const totalPage: Ref = ref(total.value / 12); +const currentPage: Ref = ref(1); if (props.page) { icones.value = icons.slice(0, 12); diff --git a/package/component/src/component/noticeBar/index.vue b/package/component/src/component/noticeBar/index.vue index aca4a77d..4c0cf137 100644 --- a/package/component/src/component/noticeBar/index.vue +++ b/package/component/src/component/noticeBar/index.vue @@ -1,18 +1,18 @@ @@ -63,12 +63,10 @@ export default { @@ -33,14 +58,12 @@ const handleClick = function () {
- = withInstall(Component); +export default component; \ No newline at end of file diff --git a/package/component/src/component/radioGroup/index.vue b/package/component/src/component/radioGroup/index.vue new file mode 100644 index 00000000..26e1fe47 --- /dev/null +++ b/package/component/src/component/radioGroup/index.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/package/component/src/component/select/index.vue b/package/component/src/component/select/index.vue index 3a1147a7..6b67590d 100644 --- a/package/component/src/component/select/index.vue +++ b/package/component/src/component/select/index.vue @@ -34,10 +34,9 @@ export interface LaySelectProps { items?: { label: string; value: string | number | [] | null; key: string }[]; } -const selectRef = ref(null); +const selectRef = ref(); -// @ts-ignore -onClickOutside(selectRef, (event) => { +onClickOutside(selectRef, (event: Event) => { openState.value = false; }); @@ -53,7 +52,6 @@ const props = withDefaults(defineProps(), { const openState = ref(false); const open = function () { - // 禁用 if (props.disabled) { openState.value = false; return; diff --git a/package/component/src/index.ts b/package/component/src/index.ts index 1c78cfb0..98588f1d 100644 --- a/package/component/src/index.ts +++ b/package/component/src/index.ts @@ -11,6 +11,7 @@ import LayBacktop from "./component/backTop/index"; import LayAvatar from "./component/avatar/index"; import LayAvatarList from "./component/avatarList/index"; import LayRadio from "./component/radio/index"; +import LayRadioGroup from "./component/radioGroup/index"; import LayButton from "./component/button/index"; import LayButtonContainer from "./component/buttonContainer/index"; import LayButtonGroup from "./component/buttonGroup/index"; @@ -90,6 +91,7 @@ const components: Record = { LaySplitPanel, LaySplitPanelItem, LayRadio, + LayRadioGroup, LayButton, LayIcon, LayBacktop, @@ -178,6 +180,7 @@ export { LaySplitPanel, LaySplitPanelItem, LayRadio, + LayRadioGroup, LayButton, LayIcon, LayBacktop, diff --git a/package/document/src/document/zh-CN/components/noticeBar.md b/package/document/src/document/zh-CN/components/noticeBar.md index 4d659a1a..d652f46a 100644 --- a/package/document/src/document/zh-CN/components/noticeBar.md +++ b/package/document/src/document/zh-CN/components/noticeBar.md @@ -84,7 +84,7 @@ export default { ::: demo @@ -94,16 +94,14 @@ import { ref,reactive } from "vue" export default { setup() { - const list = reactive([ + const list = reactive([ { id: '1', text: '条目一' }, { id: '2', text: '条目二' }, { id: '3', text: '条目三' }, { id: '4', text: '条目四' }, ]) return { - list, - } } } diff --git a/package/document/src/document/zh-CN/components/radio.md b/package/document/src/document/zh-CN/components/radio.md index 0a5c3293..efb1cef7 100644 --- a/package/document/src/document/zh-CN/components/radio.md +++ b/package/document/src/document/zh-CN/components/radio.md @@ -97,6 +97,39 @@ export default { ::: +::: title 事件回调 +::: + +::: demo + + + + + +::: + ::: title Radio 属性 :::