Comments (5)
@kissu Functionality of mentioned module is duplicate in the last version of nuxt/components, you can directly use <component :is="">
. And other than integration with vue-lazy-hydration (#104) I do not recommend using it.
I think what this issue requires, is a way to check the existence of a component before using it. While we can make it sexier with a wrapper component like <NuxtComponent :name="">
or $components.has()
, we can do this like this with Vue options api:
<component :is="componentId" v-if="$options.components[componentId]" />
Or from js:
import Vue from 'vue'
const componentExists = id => !!Vue.options.components[id]
Sandbox: https://codesandbox.io/s/immutable-wave-umwmz?file=/pages/index.vue:70-100
from components.
@vhoyer in vue3 you can use resolveComponent to check if a component exists. Nuxt/components is not needed in Nuxt3 since components gets auto-imported by the framework itself.
from components.
Did you tried this one? https://github.com/blokwise/dynamic#readme
from components.
The problem with that is that options.components
only list the "loaded" ones. I can't see how to check if the component can be autoloaded before the :is
to provide a "fallback" component in case the one I'm looking for does not exists (dinamic component name based on options)
from components.
What about this but using vue 3?
from components.
Related Issues (20)
- Render function or template not defined in component HOT 9
- Dependency Dashboard
- Since updating from Nuxt 2.15.4 to 2.15.8, auto import components no longer work HOT 15
- Support custom resolvers HOT 1
- Problem after 2.1.8, app breaks if using lodash as plugin HOT 6
- Auto import components with nested directory cant use go to define on Visual Studio Code HOT 3
- Size after building is bigger with `components: true`
- Can a library module still import components manually? HOT 1
- Autoloading breaks when file exports multiple components at once.
- Nuxt build fails when using yarn berry plug-n-play mode
- Production build with directories marked with `isAsync: false` imports components asynchronously HOT 2
- A way to get an array of all the components that are autoloaded
- How to have typescript inference with this? HOT 1
- How to avoid nuxt-i18n error when you doing testing with Jest?
- SCSS variables not working
- Nuxt 3.0.0 support HOT 1
- Component automatically introduces the generated component name.
- Remove suffix (.component.vue)
- How to use Lazy loading component when auto imports for component is disabled? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from components.