layer.confirm(msg, { title: '提示', btn: ['结束', '继续', '取消'], btn1: 'btn-danger', btn2: 'btn-default', btn3: 'btn-warning' }, function () { saveStage(that.stageObj, { isEnd: 2 }); }, function () { saveStage(that.stageObj, { isEnd: 1 }); return false; }) 按钮样式无效
时间: 2024-02-10 16:04:56 浏览: 51
如果设置的按钮样式无效,可能是因为样式类名没有正确引用。请确保样式类名的定义存在,并且在当前页面中可以正确引用。另外,也可能是因为当前页面中引用了其他样式库,导致样式冲突或被覆盖。这时可以考虑使用 !important 来强制应用样式,例如:
```
layer.confirm(msg, {
title: '提示',
btn: ['结束', '继续', '取消'],
btn1: 'btn-danger',
btn2: 'btn-default',
btn3: 'btn-warning'
}, function () {
saveStage(that.stageObj, { isEnd: 2 });
}, function () {
saveStage(that.stageObj, { isEnd: 1 });
return false;
});
// CSS样式
.btn-danger {
color: #fff !important;
background-color: #d9534f !important;
border-color: #d43f3a !important;
}
.btn-default {
color: #333 !important;
background-color: #fff !important;
border-color: #ccc !important;
}
.btn-warning {
color: #fff !important;
background-color: #f0ad4e !important;
border-color: #eea236 !important;
}
```
在上面的例子中,使用了 !important 来强制应用样式,确保样式能够正确地被应用。如果还有问题,请检查样式类名的定义和引用,并确保没有其他样式库的冲突。