fix(module): retain props reactivity through useUI (#745)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Aditio Pangestu
2023-09-28 19:06:57 +07:00
committed by GitHub
parent 874447cb41
commit 109ec52d50
36 changed files with 237 additions and 99 deletions

View File

@@ -39,7 +39,7 @@
</template>
<script lang="ts">
import { ref, computed, onMounted, onUnmounted, watchEffect, defineComponent } from 'vue'
import { ref, computed, toRef, onMounted, onUnmounted, watchEffect, defineComponent } from 'vue'
import type { PropType } from 'vue'
import { twMerge, twJoin } from 'tailwind-merge'
import UIcon from '../elements/Icon.vue'
@@ -106,6 +106,10 @@ export default defineComponent({
return ['gray', ...appConfig.ui.colors].includes(value)
}
},
class: {
type: [String, Object, Array] as PropType<any>,
default: undefined
},
ui: {
type: Object as PropType<Partial<typeof config & { strategy?: Strategy }>>,
default: undefined
@@ -113,7 +117,7 @@ export default defineComponent({
},
emits: ['close'],
setup (props, { emit }) {
const { ui, attrs, attrsClass } = useUI('notification', props.ui, config)
const { ui, attrs } = useUI('notification', toRef(props, 'ui'), config)
let timer: any = null
const remaining = ref(props.timeout)
@@ -124,7 +128,7 @@ export default defineComponent({
ui.value.background,
ui.value.rounded,
ui.value.shadow
), attrsClass)
), props.class)
})
const progressClass = computed(() => {