【发布时间】:2022-01-13 17:03:17
【问题描述】:
我正在使用 sweetalert2 库来显示基本的警报消息,但有些消息比其他消息更广泛。
可以将alert容器的witdh设置为auto,这样消息就可以一行固定了?
作为默认行为,我认为宽度设置为 360px,但我需要一种解决方法来使其自动...希望有人可以帮助我...谢谢
PD:如果重要的话,我使用的是 Symfony 4.4。默认配置为:
const Toast = Swal.mixin({
toast: true,
position: 'top',
showConfirmButton: false,
timer: 3000,
timerProgressBar: true,
});
以及模板中的fire事件:
<script>
{% for type, msgs in app.session.flashBag.all() %}
{% for msg in msgs %}
Toast.fire({
icon: '{{ type }}',
title: '{{ msg }}'
});
{% endfor %}
{% endfor %}
</script>
【问题讨论】:
标签: javascript css sweetalert2