Vue 3 can't compile template with custom components that are imported locally. #6607
Unanswered
kkqy
asked this question in
Help/Questions
Replies: 3 comments 1 reply
-
import vue from '@vitejs/plugin-vue';
vue({
template: {
compilerOptions: {
isCustomElement: (tag) => tag.includes('-'),
},
},
}), |
Beta Was this translation helpful? Give feedback.
1 reply
-
Why is it necessary to use <script lang="ts" setup>
import { reactive } from 'vue';
import { LeTextField, SeTextField } from 'awesome-components'; // Web Components
const flux = reactive({
text: '',
inputText(event: Event) {
flux.text = (event.target as HTMLInputElement).value;
},
});
</script>
<template>
<component :is="'se-text-field'" :value="flux.text" @input="flux.inputText"></component>
<!-- built by Lit -->
<le-text-field :value="flux.text" @input="flux.inputText"></le-text-field>
<!-- built by Svelte -->
<se-text-field :value="flux.text" @input="flux.inputText"></se-text-field>
{{ flux.text }}
</template> |
Beta Was this translation helpful? Give feedback.
0 replies
-
The answer : https://stackoverflow.com/questions/78135450/how-to-compile-a-vue-template-with-other-components |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
<component :is="compile(text.replace(/{(0x\d{2})}/, '<my-component :data=\'$1\'></my-component>'))" />
but it doesn't work:
I have to register my component globally, and then it works well.
so, does "compile" function support only global components?
I didn't find any document of Vue 3 about this.
Beta Was this translation helpful? Give feedback.
All reactions