1 <template> 2 <div> 3 <!-- 9 drawer 抽屉 --> 4 <el-radio-group v-model="direction"> 5 <el-radio label="ltr">从左往右开</el-radio> 6 <el-radio label="rtl">从右往左开</el-radio> 7 <el-radio label="ttb">从上往下开</el-radio> 8 <el-radio label="btt">从下往上开</el-radio> 9 </el-radio-group> 10 11 <el-button @click="drawer = true" type="primary" style="margin-left: 16px;"> 12 点我打开 13 </el-button> 14 15 <el-drawer 16 title="我是标题" 17 :visible.sync="drawer" 18 :direction="direction" 19 :before-close="handleClose"> 20 <span>我来啦!</span> 21 </el-drawer> 22 <!-- 9 --> 23 </div> 24 </template> 25 26 <script> 27 export default { 28 data() { 29 return { 30 drawer: false, 31 direction: 'rtl', 32 }; 33 }, 34 methods: { 35 handleClose(done) { 36 this.$confirm('确认关闭?') 37 .then(_ => { // 下划线老是报错呢? 38 done(); 39 }) 40 .catch(_ => {}); 41 } 42 } 43 }; 44 </script>