ci: vue/use
This commit is contained in:
parent
ed312c40b1
commit
9726687879
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@layui/layui-vue",
|
"name": "@layui/layui-vue",
|
||||||
"version": "0.3.9-alpha.1",
|
"version": "0.3.9-alpha.2",
|
||||||
"author": "就眠儀式",
|
"author": "就眠儀式",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "a component library for Vue 3 base on layui-vue",
|
"description": "a component library for Vue 3 base on layui-vue",
|
||||||
@ -37,9 +37,9 @@
|
|||||||
"vue": "^3.2.31"
|
"vue": "^3.2.31"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@layui/hooks-vue": "^0.1.7",
|
|
||||||
"@layui/icons-vue": "^1.0.7",
|
"@layui/icons-vue": "^1.0.7",
|
||||||
"@layui/layer-vue": "^1.3.5",
|
"@layui/layer-vue": "^1.3.5",
|
||||||
|
"@vueuse/core": "^7.6.2",
|
||||||
"async-validator": "^4.0.7",
|
"async-validator": "^4.0.7",
|
||||||
"countup.js": "^2.0.8",
|
"countup.js": "^2.0.8",
|
||||||
"evtd": "^0.2.3",
|
"evtd": "^0.2.3",
|
||||||
|
@ -131,7 +131,6 @@ let blue = ref(0);
|
|||||||
let alpha = ref(1);
|
let alpha = ref(1);
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log(props.modelValue)
|
|
||||||
let { r, g, b, a } = parseColor(props.modelValue);
|
let { r, g, b, a } = parseColor(props.modelValue);
|
||||||
red.value = r;
|
red.value = r;
|
||||||
green.value = g;
|
green.value = g;
|
||||||
|
@ -5,20 +5,23 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { provide, ref, watch } from "vue";
|
import { provide, ref, watch } from "vue"
|
||||||
import { useClickOutside } from "@layui/hooks-vue";
|
import { onClickOutside } from "@vueuse/core"
|
||||||
|
|
||||||
export interface LayDropdownProps {
|
export interface LayDropdownProps {
|
||||||
trigger?: string;
|
trigger?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const dropdownRef = ref<null | HTMLElement>(null);
|
const dropdownRef = ref<null | HTMLElement>(null);
|
||||||
const isClickOutside = useClickOutside(dropdownRef);
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LayDropdownProps>(), {
|
const props = withDefaults(defineProps<LayDropdownProps>(), {
|
||||||
trigger: "click",
|
trigger: "click",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
onClickOutside(dropdownRef, (event) => {
|
||||||
|
openState.value = false;
|
||||||
|
})
|
||||||
|
|
||||||
const openState = ref(false);
|
const openState = ref(false);
|
||||||
|
|
||||||
const open = function () {
|
const open = function () {
|
||||||
@ -33,12 +36,6 @@ const toggle = function () {
|
|||||||
openState.value = !openState.value;
|
openState.value = !openState.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
watch(isClickOutside, () => {
|
|
||||||
if (isClickOutside.value) {
|
|
||||||
openState.value = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
provide("openState", openState);
|
provide("openState", openState);
|
||||||
|
|
||||||
defineExpose({ open, hide, toggle });
|
defineExpose({ open, hide, toggle });
|
||||||
|
@ -13,11 +13,8 @@ export interface LayMenuItemProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const slots = useSlots();
|
const slots = useSlots();
|
||||||
|
|
||||||
const props = defineProps<LayMenuItemProps>();
|
const props = defineProps<LayMenuItemProps>();
|
||||||
|
|
||||||
const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>;
|
const selectedKey: Ref<string> = inject("selectedKey") as Ref<string>;
|
||||||
|
|
||||||
const selectHandle = function () {
|
const selectHandle = function () {
|
||||||
selectedKey.value = props.id;
|
selectedKey.value = props.id;
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ import {
|
|||||||
toRefs,
|
toRefs,
|
||||||
Ref,
|
Ref,
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import { useClickOutside } from "@layui/hooks-vue";
|
import { onClickOutside } from "@vueuse/core";
|
||||||
import { SelectItem } from "../../types";
|
import { SelectItem } from "../../types";
|
||||||
|
|
||||||
export interface LaySelectProps {
|
export interface LaySelectProps {
|
||||||
@ -31,13 +31,10 @@ export interface LaySelectProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const selectRef = ref<null | HTMLElement>(null);
|
const selectRef = ref<null | HTMLElement>(null);
|
||||||
const isClickOutside = useClickOutside(selectRef);
|
|
||||||
|
|
||||||
watch(isClickOutside, () => {
|
onClickOutside(selectRef, (event) => {
|
||||||
if (isClickOutside.value) {
|
openState.value = false;
|
||||||
openState.value = false;
|
})
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<LaySelectProps>(), {
|
const props = withDefaults(defineProps<LaySelectProps>(), {
|
||||||
modelValue: null,
|
modelValue: null,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user