Vue 3 The template root requires exactly one element. eslint-plugin-vue

I ended up turning off Vetur linting. Vetur thinks that it is a Vue 2 project becuase it is in a VS Code workspace. https://github.com/vuejs/vetur/issues/2299#issuecomment-696015374 You can solve this by doing F1>Preferences:Open Settings (JSON) paste “vetur.validation.template”: false, “vetur.validation.script”: false, “vetur.validation.style”: false,

Vue.js – Component is missing template or render function

FOR vue-cli vue 3 render function missed in createApp. When setting your app by using createApp function you have to include the render function that include App. in main.js update to : FIRST change the second line in javascript from:- const { createApp } = Vue to the following lines: import { createApp,h } from … Read more

How do I do Vue.set() in Vue 3?

You don’t need to. This article will help you to understand why we needed vue.set in the first place. In short, you need it so that you could add a new property to a data object without breaking the reactivity. With Vue 3, you no longer need to worry about breaking the reactivity. What the … Read more

How to set compilerOptions.isCustomElement for VueJS 3 in Laravel project

Try this in your webpack.mix.js mix.js(‘resources/assets/js/app.js’, ‘public/js’).vue({ options: { compilerOptions: { isCustomElement: (tag) => [‘md-linedivider’].includes(tag), }, }, }); UPDATE 4.8.22 – for Vite projects: vite.config.js import { defineConfig } from ‘vite’ import vue from ‘@vitejs/plugin-vue’ export default defineConfig({ plugins: [ vue({ template: { compilerOptions: { isCustomElement: (tag) => [‘md-linedivider’].includes(tag), } } }) ] })

Vue.js 3 – replace/update reactive object without losing reactivity

Though Boussadjra Brahim’s solution works its not the exact answer to the question. In the sense that reactive data can not be reassigned with = but there is a way to reassign the reactive data. It is Object.assign. Therefore this should work setup(){ const formData = reactive({}) onMounted(() => { fetchData().then((data) => { if (data) … Read more

How does Computed work in Vue 3 script setup?

In <template>: Getter only: {{ myVal }} <p v-text=”myVal” /> Getter and setter: <input v-model=”myVal”> Important: Do not use myVal.get() or myVal.set(value)! Use: getting: myVal setting (assignment): myVal = value In <script setup>: Getter only: const someReactiveRef = ref(null) const myVal = computed(() => someReactiveRef.value) Getter & setter: const someReactiveRef = ref(null) const myVal = … Read more

can’t use template ref on component in vue 3 composition api

I ran into this issue today. The problem is that, when using the <script setup> pattern, none of the declared variables are returned. When you get a ref to the component, it’s just an empty object. The way to get around this is by using defineExpose in the setup block. // Child.vue <template> <div ref=”wrapper”> … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)