Vue 与 动态组件 import 的尝试

<template>
    <component :is='fuck' :data='data'></component>
</template>

<script>
    export default {
        data() {
            return {
                fuck: null
            }
        },
        props: ['type', 'data'],
        mounted() {
            this.fuck = import(`/templates/${this.type || 'default'}`)
        },
    }
</script>
原文地址:https://www.cnblogs.com/CyLee/p/11865596.html