Skip to content

How to merge props in a better way? #554

Answered by zernonia
VanishMax asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks for starting this discussion @VanishMax . We've encountered similar issue too, and we found out that using reactivePick or reactiveOmit can be a good way to solve the headache here.

eg:

<template>
  <ToastRoot v-bind="forwarded">
    <ToastTitle>{{ title }}</ToastTitle>
    <ToastClose />
  </ToastRoot>
</template>

<script setup lang="ts">
import { reactiveOmit } from "@vueuse/core"
import type { ToastRootProps, ToastRootEmits } from 'radix-vue';
import {
  ToastClose,
  ToastRoot,
  ToastTitle,
  useForwardPropsEmits,
} from 'radix-vue';

interface ToastProps extends ToastRootProps {
  title: string;
}

const props = defineProps<ToastProps>();
const emits = defineEmits<ToastRootE…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@VanishMax
Comment options

Answer selected by VanishMax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants