ElementPlus

234 阅读1分钟

element-plus --笔记

一、深度监测

<style scoped lang="scss">
.all{
  width: 100%;
  height: 100%;
  .el-carousel{
    height: 100%;
    :deep(.el-carousel__container){
      //我支持深度检测哦
      height: 100%;
    }
  }
  img{
    width: 100%;
    height: 100%;
  }
}
</style>

二、MessageBox 和 ElMessage,确实很 Composion Api

import { ElMessageBox } from 'element-plus';
import { ElMessage } from 'element-plus';

// 这里我只是贴上两段代码,其余自行补上

setup() {
    const allDel= ()=>{
      ElMessageBox.confirm('此操作将永久删除该文件, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          ElMessage.success({
            message: '删除成功!'
          });
        }).catch(() => {
          ElMessage.info({
            message: '已取消删除'
          });
        });
    }
    return {
      allDel
    };
  },