element-ui Drawer抽屜組件封裝



<template> <div class="com"> <el-drawer title="我是標題" :visible.sync="drawer_" :direction="direction"> <span>我來啦! {{task.name}}</span> </el-drawer> </div> </template> <script> export default { props:{ task:{ type:Object, default:()=>{} }, drawer:{ type:Boolean, default:false }, direction:{ type:String, default:'rtl' } }, data(){ return { } }, computed: { drawer_:{ get(){ return this.drawer }, set(v){ this.$emit("changeDrawer",v) } } }, } </script> <style scoped> </style>

調用:

 <task-form @changeDrawer="changeDrawer" :task="taskFormData" :drawer="drawer" :direction="direction"></task-form>
        data() {
            return {
                taskData: [],// 任務數據
                drawer: false,
                direction: 'rtl',
                taskFormData:{}
            }
        },
 
    
        methods: {
            changeDrawer(v){
                this.drawer = v;
            },
    }


 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM