changes
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="is-flex is-align-items-center is-gap-1">
|
||||
<div style="width: 18px; height: 18px">
|
||||
<span class="icon">
|
||||
<Icon
|
||||
name="material-symbols:cancel-rounded"
|
||||
:size="18"
|
||||
class="has-text-danger-80"
|
||||
/>
|
||||
</div>
|
||||
</span>
|
||||
<p
|
||||
v-html="content"
|
||||
class="control is-expanded"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script setup>
|
||||
import { defineAsyncComponent } from "vue";
|
||||
import { useStore } from "@/stores/index";
|
||||
import Info from "@/components/snackbar/Info.vue";
|
||||
import Success from "@/components/snackbar/Success.vue";
|
||||
@@ -10,31 +9,7 @@ const props = defineProps({
|
||||
});
|
||||
|
||||
const store = useStore();
|
||||
const componentFiles = import.meta.glob("@/components/**/*.vue");
|
||||
const resolvedComponent = shallowRef(null);
|
||||
|
||||
function loadDynamicComponent() {
|
||||
if (!props.component) {
|
||||
resolvedComponent.value = null;
|
||||
return;
|
||||
}
|
||||
|
||||
const fullPath = `/components/snackbar/${props.component}.vue`;
|
||||
const componentPath = Object.keys(componentFiles).find((path) => path.endsWith(fullPath));
|
||||
|
||||
if (componentPath) {
|
||||
resolvedComponent.value = defineAsyncComponent(componentFiles[componentPath]);
|
||||
} else {
|
||||
console.error(`Không tìm thấy component tại: ${fullPath}`);
|
||||
resolvedComponent.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Theo dõi sự thay đổi của props.component để load lại nếu cần
|
||||
watchEffect(() => {
|
||||
loadDynamicComponent();
|
||||
});
|
||||
// setTimeout(() => store.commit("snackbar", undefined), 3900);
|
||||
setTimeout(() => store.commit("snackbar", undefined), 3900);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<template>
|
||||
<div class="is-flex is-align-items-center is-gap-1">
|
||||
<div style="width: 18px; height: 18px">
|
||||
<span class="icon">
|
||||
<Icon
|
||||
name="material-symbols:check-circle-rounded"
|
||||
:size="18"
|
||||
class="has-text-success-70"
|
||||
/>
|
||||
</div>
|
||||
</span>
|
||||
<p
|
||||
v-html="content"
|
||||
class="control is-expanded"
|
||||
|
||||
Reference in New Issue
Block a user