【发布时间】:2020-01-21 08:00:52
【问题描述】:
我有一个基于变量“场景”的值动态加载的组件。问题是我必须在组件下导入和加载所有可能的场景,而且我有很多不同的可能组件。 Vue 是否可以只动态导入传入的场景,还是我需要在开始时导入所有内容?
出于其他原因,我不想在这种情况下使用路由器。
<component
:is="scene"
v-bind="options"
>
</component>
=========
import TitleSceneComponent
from './scenes/common/TitleSceneComponent.vue';
import NarrationSceneComponent
from './scenes/common/NarrationSceneComponent.vue';
import ChoiceSceneComponent
from './scenes/common/ChoiceSceneComponent.vue';
components: {
TitleScene: TitleSceneComponent,
NarrationScene: NarrationSceneComponent,
ChoiceScene: ChoiceSceneComponent,
},
【问题讨论】:
标签: vue.js