vue confirm弹窗提示确认,修改提示的字体颜色

1.日常写法

 this.$confirm(
        context,
        "提示",
        {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
        }
    	)
        .then(function () {
            return publishFaultMobleScheduling(mapObject);
        })
        .then(() => {
            this.getList(this.scheduleType);
            this.msgSuccess("发布成功");
        });

2.修改提示框内容字体

2.1思路

(1)使用const h = this.$createElement写弹出确认框。

(2)$createElement参数用法

h('p', null,{class:'test'} [
        h('span', "提示内容", '内容可以是 '),
        h('p', { style: 'color: red' }, "第一行"),
        h('p', { style: 'color: red' }, null)
    ]),

第一行创建一个什么标签。案例为p标签,也可以为div标签等。可以自定义class,
第二行P标签下面放入一个列表标签。

  • 第1个参数:标签,节点标签是什么。
  • 第2个参数:定义style格式
  • 第2个参数:文件信息,如果为null,不显示。可以根据提示类别把该该赋为null进行不显示。

2.2 案例

const h = this.$createElement;
this.$confirm('', {
    title:"提示",
    type:'warnig',
    message:h('p', null, [
        h('span', "提示内容", '内容可以是 '),
        h('p', { style: 'color: red' }, "第一行"),
        h('p', { style: 'color: red' }, null)
    ]),
    // iconClass:"el-icon-question colorYellow",
	})
    .then(function () {
        return publishFaultMobleScheduling(mapObject);
    })
    .then(() => {
        this.getList(this.scheduleType);
        this.msgSuccess("发布成功");
    });

2.3 案例页面展示

在这里插入图片描述

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

怪异的bug

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值