我想用自定义bold
在小写text color
中创建文本,由于不再支持html:true
,我尝试设置<span>
并设置我对html标记的自定义style
,但没有用,我搜索了解决方案,但没有任何答案。
代码
swal({
title: "Summary",
content: '<span>"counter " + this.counterType_1 + ": "+ this.counter_1_from.value.counter_1 +" - Sold Liters: " + liter_sold_1</span>',
className: "success",
closeOnClickOutside: false,
closeOnEsc: false,
dangerMode: true,
buttons: {
submit: {
text: "Submit",
value: "submit",
},
noAction: {
text:"Cancel",
value: "Cancel",
},
},
})
我尝试过的事情
var _html= '<span>"counter " + this.counterType_1 + ": "+ this.counter_1_from.value.counter_1 +" - Sold Liters: " + liter_sold_1</span>',
content: _html,
但也不起作用。
答案 0 :(得分:0)
我终于找到一种使用createElement()
方法的方法,该方法将一个param标签作为参数,
var wrapper = document.createElement('h1');
wrapper.innerHTML = 'this is bold text';
swal({
content:wrapper,
title: "Summary",
className: "success",
closeOnClickOutside: false,
closeOnEsc: false,
dangerMode: true,
})