<template>
<v-container class="fill-height" fluid>
<component :is="app" />
</v-container>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
@Component({
components: {
login: () => import("@/components/common/Login.vue"),
registry: () => import("@/components/common/Registry.vue"),
get: () => import("@/components/common/Get.vue")
}
})
export default class Basecom extends Vue {
@Prop(String) appname!: string;
public app = "";
@Watch("appname", { immediate: true, deep: true })
onPersonChanged(val: string, oldVal: string) {
this.app = val;
}
}
</script>
<style scoped></style>
如代码所示,appname是由父组件传过来的,我想将components的login
,get
,registrt
和import对应的xxx.vue用appname来替代,不知道有什么解决方法?
可以。你需要把requirejs打包进项目,用真实的相对路径。