文章

顯示從 7月, 2024 起發佈的文章

vue3 send a class into a component as a prop

  < script setup > import { ref , computed } from "vue" ; const props = defineProps ([ "link" , "loading" , "type" , "propClass" , "disabled" ]); const btnClass = computed (() => ({   btn : true ,   "btn-secondary" : props . type === "secondary" ,   "btn-tertiary" : props . type === "tertiary" ,   "btn-outlined" : props . type === "outlined" ,   "btn-outlined-secondary" : props . type === "outlined-secondary" ,   "btn-outlined-tertiary" : props . type === "outlined-tertiary" ,   "btn-text" : props . type === "text" ,   "btn-text-secondary" : props . type === "text-secondary" ,   "btn-text-tertiary" : props . type === "text-tertiary" ,   [ props .propClass]: props . propClass ? true : false , })); </ script >