vue3 converted to composite api then displays nothing
P粉106711425
P粉106711425 2023-09-04 20:42:43
0
1
435
<p>I checked a few times but my options API doesn't work after I converted it to a composite API. I don't know what's wrong with it and it doesn't show any errors. However, it doesn't print anything to the screen like my options API does. It only shows warnings. </p> <p>runtime-core.esm-bundler.js:40 [Vue warn]: Unable to resolve component: onboardland If this is a native custom element, make sure to exclude it from component resolution via </p> <p>This is my composite api, not working</p> <pre class="brush:php;toolbar:false;"><template> <div> <onboardland /> <onboardshow /> </div> </template> <script> import onboardland from './onboardland.vue' import onboardshow from './onboardshow.vue' export default { setup() { return { components: { onboardland, onboardshow } }; } }; </script></pre> <p>Here are the running options api</p> <pre class="brush:php;toolbar:false;"><template> <div> <onboardland /> <onboardshow /> </div> </template> <script> import onboardland from './onboardland.vue' import onboardshow from './onboardshow.vue' export default { components: { onboardland, onboardshow } } </script></pre></p>
P粉106711425
P粉106711425

reply all(1)
P粉427877676

When using the composition API definition Vue SFC.

You can use the method or you can use the normal and setup functions and optional defineComponent.

use

<template>
  <div>
    <OnboardLand />
    <OnboardShow />
  </div>
</template>

<script setup>
import OnboardLand from './onboardland.vue'
import OnboardShow from './onboardshow.vue'

// composition goes here...
</script>

Use defineComponent

<template>
  <div>
    <OnboardLand />
    <OnboardShow />
  </div>
</template>

<script>
import { defineComponent } from 'vue';
import OnboardLand from './onboardland.vue'
import OnboardShow from './onboardshow.vue'

export default defineComponent({
  components: {
    OnboardLand,
    OnboardShow,
  },
  setup(props) {
    // composition goes here.
  },
})
</script>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template