Element UI学习8--this.$prompt,this.$message,this.$confirm,this.$notify

本文介绍了Element UI中常用的四个弹窗组件:$prompt用于输入框弹窗,$message用于消息提示,$confirm用于确认操作的弹框,而$notify则用于显示提示信息。每个组件都配合示例图片进行了详细说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、this.$prompt

输入框弹窗

if (object == undefined) {
        this.$prompt('请输入', '添加优惠券分类', {
          confirmButtonText: '确定',
          cancelButtonText: '取消'
        }).then(async ({ value }) => {
          
          })

如图:
在这里插入图片描述

2、this.$message

消息提示

if (result.result) {
            this.$message({
              type: 'success',
              message: '添加成功'
            })
            this.getData()
          } else {
            this.$message({
              type: 'error',
              message: result.msg
            })
          }

如图:
在这里插入图片描述

3、,this.$confirm

确认弹框

handleDel(row) {
      this.$confirm(`确认删除图片 ${row.pictureName} 吗?`, '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.deletePicture(row.id)
      }).catch(() => {});
    },

如图:
在这里插入图片描述

4、this.$notify

提示信息

if (file) {
        this.$notify({
          title: '成功',
          message: '图片上传成功',
          type: 'success'
        });
      }

如图:
在这里插入图片描述

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值