module.vue 1.25 KB
<template>
    <div class="mwraper">
       <component ref="module" :is="mkey" :title="title" :ckey="ckey" :icon="icon" :data="data" :level="level" :pagination="pagination" :action="action">
           <template slot="action">
                <slot name="action"/>
            </template>
       </component>
    </div>
</template>

<script>
//import mallOptionContent from './mallOptionContent'
import moduleData,{loadModule} from '../module';
//loadModule('card')
export default {
    props: {
        mkey: String,
        ckey: String,
        title:String,
        icon:String,
        data:Object,
        level:Array,
        action:Boolean,
        pagination:Boolean
    },
    inject: ['addModule'],
    components: {
        ...moduleData
    },
    data() {
        return {
            
        }
    },
    methods: {
        
    },
    created() {
        if(!this.mkey||!Object.keys(moduleData).includes(this.mkey)){
           return console.error('不存在指定的module:',this.mkey); 
        }
    },
    mounted(){
        this.addModule(this.$refs.module);
    }
}
</script>

<style scoped>
    .mwraper{
        background: #fff;
        box-sizing: border-box;
        position: relative;
        width: 100%;
        padding: 16px 20px;
    }
</style>