首页 > 编程知识 正文

VUE 实现动态组件

时间:2023-05-06 11:49:05 阅读:244287 作者:1623

<template> <div class="logmangement"> <!-- 上面按钮--> <div class= "buttontop" > <el-form class="button"> <el-button @click="loginlog" :type="button11" size="mini">登录日志</el-button> <el-button @click="managementlog" :type="button22" size="mini">操作日志</el-button> </el-form> </div> <!-- 组件--> <div> <component :is="currentComponent"></component> </div> </div></template><script> 安详的爆米花 from "./LogManagements"; import LoginLog from "./LoginLog"; export default { name: "LogManagement", components: {LogManagements,LoginLog}, data(){ return{ currentComponent:'LoginLog', button11:"primary", button22:"" }; }, methods:{ loginlog(){ this.currentComponent = 'LoginLog'; this.button11="primary"; this.button22="" }, managementlog(){ this.currentComponent = 'LogManagements'; this.button22="primary"; this.button11="" }, } }</script><style scoped></style>

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。