首页 > 解决方案 > Sweat Alert 2 文本区域未动态调整宽度

问题描述

我为自己创建了一个甜蜜的警报文本框,它使用“textarea”作为其输入属性。这意味着可以拖动文本框来调整其大小。它与https://sweetalert2.github.io/上的示例完全相同,但与网站上的示例不同,我的代码不会动态调整其宽度。您可以在代码段中自己进行测试,高度调整大小但宽度不调整。考虑到我是从他们自己的网站上逐字复制的,我不知道为什么它不起作用。任何见解都会很棒,也许我在这里遗漏了一些东西。

swal({
    input: 'textarea',
  title: 'Message',
  inputPlaceholder: 'Type your message here...',
  inputAttributes: {
    'aria-label': 'Type your message here'
  },
  showCancelButton: true
    },
    function(){
      location.href= "http://example.com";
    });
<script src="https://cdn.jsdelivr.net/g/sweetalert2@6.6.0(sweetalert2.min.js+sweetalert2.js)"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/g/sweetalert2@6.6.0(sweetalert2.min.css+sweetalert2.css)">

标签: javascriptuser-interfaceresizetextareasweetalert

解决方案


推荐阅读