vue3 converted to composite api then displays nothing
P粉106711425
2023-09-04 20:42:43
<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>
When using the composition API definition Vue SFC.
You can use the
method or you can use the normal
and
setup
functions and optionaldefineComponent
.use
Use
defineComponent