Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

vue 3 script setup dynamic component sample

<template>
  <button @click="changeTab(CompB)">
    Change
  </button>
  <component :is="tab"></component>
</template>

<script setup>
import CompA from './CompA.vue'
import CompB from './CompB.vue'
import { ref, markRaw } from 'vue'

const tab = ref(null)

changeTab(CompA)
function changeTab (comp) {
  tab.value = markRaw(comp)
}
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs for windows 7 
Javascript :: Pass object to query on Router.push NextJs 
Javascript :: vue call method after render 
Javascript :: vue get if checkbox is checked 
Javascript :: node js post method 
Javascript :: how to get output of console.log in a file in javascript 
Javascript :: merge objects js 
Javascript :: how to assert element attributes in cypress 
Javascript :: vscode rest api extention POST method 
Javascript :: convert a new date standard to a yyy-mm-dd format in javascript 
Javascript :: create module with routing in angular 13 
Javascript :: react render component after data loaded 
Javascript :: oneerror javascript image 
Javascript :: anagram javascript example 
Javascript :: ejs display variable 
Javascript :: simple alert program in javascript 
Javascript :: js char array to string 
Javascript :: gesture handling with react native expo 
Javascript :: javascript separate string by character 
Javascript :: array shuffle 
Javascript :: js array from 
Javascript :: how to remove child element in jquery 
Javascript :: storing an image file into buffer field with mongoose 
Javascript :: react Refused to execute inline script because it violates the following Content Security Policy directive 
Javascript :: fetch get request 
Javascript :: javascript get time 
Javascript :: json_insert mysql 
Javascript :: nodejs call api 
Javascript :: angular router outlet 
Javascript :: disable button based on condition angular 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =