sweetalert 相关问题

SweetAlert是一个JavaScript库,它提供标准alert()对话的替代品。

sweetalert 2 中的输入不可输入或无法在materializecss 模式中输入

我有一个模式,当我点击添加账单按钮时,它会弹出sweetalert2,下面提供的代码来自他们的文档,所以我认为代码没有问题,无论如何,我的

回答 6 投票 0

sweetAlert 的返回值

我正在使用 sweetalert 插件来显示通知...... 现在我需要从是/否确认中获取价值 函数确认(消息){ 斯瓦尔({ 标题:“你确定吗?”, 文本:消息, 类型:“警告”,

回答 3 投票 0

将 Sweet Alert 与 Typescript 类一起使用

我在打字稿类中有一个方法,看起来像这样 var确认=确认(“运行代理作业?”); 如果(确认){ console.log('是'); } 别的 { 缺点...

回答 5 投票 0

sweetalert 2 中的输入无法在材料 UI 模式反应 js 中输入

我有一张卡来显示订单,卡内取消时会打开 sweetalert2 弹出窗口,询问取消原因。这在订单屏幕上运行得很好。 我有一张卡来显示订单,卡内取消时会打开 sweetalert2 弹出窗口,询问取消原因。这在订单屏幕上运行得很好。 <Grid item md={8} sm={12}> orders.map((order) => <SupplierOrderBlock data={order} />) </Grid> 取消后,这些大火。第一个要求用户输入原因,如果用户没有输入原因,第二个甜蜜警告会提示用户输入原因才能取消。 const cancelOrder = (orderID, status) => { Swal.fire({ title: "Are You Sure You Want to Cancel Order", text: "Please Enter the reason for the cancellation of order", input: "text", showCancelButton: true, confirmButtonColor: "#1c8fec", cancelButtonColor: "#fa013b", customClass: 'swal-wide' }).then((result) => { if (result.value == '') { swal({ title: "You can not cancel without giving a reason", showCancelButton: true, confirmButtonColor: "#1c8fec", cancelButtonColor: "#fa013b", buttons: { Confirm: { text: "Okay", className: "okayButton" }, }, }); } else if (result.isConfirmed) { //cancel order} 这工作得很好。 现在,当我尝试在 Material UI 模式中的仪表板上使用相同的组件时,它不允许我输入文本。 <Modal open={modal} onClose={handleClose} aria-labelledby="simple-modal-title" aria-describedby="simple-modal-description" style={{ width: "60%", zIndex: 1, marginLeft: '-10%' }} > <Box style={{ marginLeft: "50%", marginTop: "25vh", width: "100%", position: 'absolute' }}> <SupplierOrderBlock data={supplierorder} /> </Box> </Modal> 如果我从模态中删除 Z-index 属性,则 swal 会位于模态后面 但是关闭模式后它可以让我们输入原因 从 mui 抽屉打开 sweet Alert2 时我也遇到了同样的问题 并能够使用disableEnforceFocus修复它 标记到我的 mui 抽屉 禁用EnforceFocus >

回答 1 投票 0

错误:node_modules/sweetalert/typings/sweetalert.d.ts:4:9 - 错误 TS2403

错误:node_modules/sweetalert/typings/sweetalert.d.ts:4:9 - 错误 TS2403:后续变量声明必须具有相同类型。变量 'swal' 必须是 'typeof import("C:/Users/U...

回答 0 投票 0

如何在 laravel 中添加甜蜜警报? [重复]

我目前正在学习 html 之后的 laravel。我想不出一种专门在按钮中实现甜蜜警报的方法。 你们可以教我怎么做吗? 我想知道如何在 laravel 中添加 sweet alert

回答 0 投票 0

SweetAlert 变量

我希望能够在 SweetAlert 的标题和文本中包含一个 SweetAlert 变量。 我有以下代码: swal({ 标题:“登录”, 文本:“登录到...

回答 0 投票 0

Laravel:当数据加载到数据库中时,如何关闭 Sweetalert?

我在我的项目中运行上传数据,当数据加载到数据库中时,我希望关闭 sweetalert。这是我的 sweetalert 代码: document.getElementById('subImport').click(); $(文档...

回答 0 投票 0

我的 php jquery ajax 表单请求有时会触发两次,可能是 10 个请求中的 2 个

下面是我提交表格的代码。 发送的 10 个请求中有 8 个工作正常,而其他请求会触发两次或三次,但会返回一个响应以显示甜蜜的警报。 我利用甜蜜警报

回答 0 投票 0

Sweet Alert 消息问题,它没有出现在表单提交

成功提交表单数据后,我试图使用甜蜜警报功能显示弹出消息。我的数据正在插入到数据库中,但在成功插入消息后,包括...

回答 0 投票 0

如何解决此警告:SweetAlert2:未知参数“onOpen”?

我的甜蜜警报显示此警告,我该如何解决?任何想法 当我触发这个 Sweet Alert 时不知道是什么原因导致这个警告,它显示了这个警告。

回答 0 投票 0

提交后的甜蜜警报消息不起作用

我正在尝试在数据库中插入记录后显示警报消息,正常的 js 警报工作正常并显示消息。 回声''; echo 'alert(" 你的 re...</desc> <question vote="0"> <p>我正在尝试在数据库中插入记录后显示一条警报消息,正常的 js 警报工作正常并显示消息。</p> <pre><code>echo &#39;&lt;script&gt;&#39;; echo &#39;alert(&#34; Your request has been successfully filled and your Letter No is\n&#39;.$Dep.&#39;/&#39;.$fy.&#39;/ &#34;+&#34;&#39;.$id.&#39;.\nKindly submit the original copy of this letter to CRDS.&#34;)&#39;; echo &#39;&lt;/script&gt;&#39;; echo &#34;&lt;script&gt;window.location.href=&#39;dashboard.php&#39;&lt;/script&gt;&#34;; exit; </code></pre> <p>但是当我使用 sweet alert 函数而不是普通的 js 函数时,它不显示任何消息。它直接将我带到标题。我用 sweet alert2 尝试过但没有快乐。虽然插入了数据但未显示消息我的代码有什么问题我的代码中包含了甜蜜的警报库。我的代码是</p> <pre><code>echo &#39;&lt;script&gt;&#39;; echo &#39;swal(&#34; Your request has been successfully filled and your Letter No is\n&#39;.$Dep.&#39;/&#39;.$fy.&#39;/ &#34;+&#34;&#39;.$id.&#39;.\nKindly submit the original copy of this letter to CRDS.&#34;)&#39;; echo &#39;&lt;/script&gt;&#39;; echo &#34;&lt;script&gt;window.location.href=&#39;dashboard.php&#39;&lt;/script&gt;&#34;; exit; </code></pre> </question> </body></html>

回答 0 投票 0

甜蜜提醒功能不显示消息

在记录插入数据库后,我试图显示一条警报消息,正常的 js 警报工作正常,代码是 回声''; echo 'alert(" 你的请求有 </desc> <question vote="3"> <p>我试图在记录插入数据库后显示一条警报消息,正常的 js 警报工作正常,代码是</p> <pre><code>echo &#39;&lt;script&gt;&#39;; echo &#39;alert(&#34; Your request has been successfully filled and your Letter No is\n&#39;.$Dep.&#39;/&#39;.$fy.&#39;/ &#34;+&#34;&#39;.$id.&#39;.\nKindly submit the original copy of this letter to CRDS.&#34;)&#39;; echo &#39;&lt;/script&gt;&#39;; echo &#34;&lt;script&gt;window.location.href=&#39;dashboard.php&#39;&lt;/script&gt;&#34;; exit; </code></pre> <p>但是当我使用 sweet alert 函数而不是普通的 js 函数时,它不显示任何消息。我的代码有什么问题>我在我的代码中包含了 sweet alert 库。我的代码是</p> <pre><code>echo &#39;&lt;script&gt;&#39;; echo &#39;swal(&#34; Your request has been successfully filled and your Letter No is\n&#39;.$Dep.&#39;/&#39;.$fy.&#39;/ &#34;+&#34;&#39;.$id.&#39;.\nKindly submit the original copy of this letter to CRDS.&#34;)&#39;; echo &#39;&lt;/script&gt;&#39;; echo &#34;&lt;script&gt;window.location.href=&#39;dashboard.php&#39;&lt;/script&gt;&#34;; exit; </code></pre> </question> <answer tick="false" vote="0"> <p>swal 函数很可能是错误的,查看 swal 文档,这里有一个如何使用它的例子,也许你错过了火。</p> <pre><code>Swal.fire( &#39;Good job!&#39;, &#39;You clicked the button!&#39;, &#39;success&#39; ) </code></pre> <p>在警报的那一边,但是如果我们更深入地看这个主题,在最后一行中您正在使用 window.location.href 更改 url,那么最好以不同的方式评论或实现它,因为那里您正在将其重定向到另一个页面,并且不会显示警报。</p> </answer> <answer tick="false" vote="0"> <p>使用 SweetAlert 你可以简单地使用:</p> <p><pre><code>echo &#39;swal(&#34;Some&#39;.$variable.&#39;text!&#34;, &#34;You clicked the button!&#34;, &#34;success&#34;)&#39;;</code></pre></p> <p>但是在<pre><code>SweetAlert2</code></pre>你可以简单地使用:</p> <pre><code>echo ;Swal.fire( &#39;Some&#39;.$variable.&#39;text!&#39;, &#39;You clicked the button!&#39;, &#39;success&#39; )&#39;; You can try this one `echo &#34;&lt;script&gt; Swal.fire({ title: &#39;Successfully save!&#39;, html: `Your request has been successfully filled and your Letter No is\n ${$Dep}/${$fy}/${$id}\nKindly submit the original copy of this letter to CRDS..`, timer: 2000, timerProgressBar: true, }).then((result) =&gt; { window.location.href=&#39;dashboard.php&#39; }) &lt;/script&gt;&#34; ` </code></pre> </answer> <answer tick="false" vote="0"> <p>在你的标题中,</p> <p><strong>添加,</strong></p> <pre><code>&lt;head&gt; &lt;script src=&#34;https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js&#34;&gt;&lt;/script&gt; &lt;script src=&#34;jquery-3.3.1.min.js&#34;&gt;&lt;/script&gt; &lt;/head&gt; </code></pre> <p><strong>那么,</strong></p> <pre><code>echo &#34;&lt;script type=&#34;text/javascript&#34;&gt; $(document).ready(function(){ Swal.fire({ title: &#39;Successfully save!&#39;, html: `Your request has been successfully filled and your Letter No is\n ${$Dep}/${$fy}/${$id}\nKindly submit the original copy of this letter to CRDS..`, timer: 1500, timerProgressBar: true, }).then((result) =&gt; { window.location.href=&#39;dashboard.php&#39; })}); &lt;/script&gt;&#34; </code></pre> </answer> </body></html>

回答 0 投票 0

SweetAlert 通过 Ajax 请求确认

我是 Javascript 的新手 - 第一次实际编码。 我正在尝试使用 SweetAlert 做一个带有删除确认的按钮。当我按下带有 onclick="confirmDelet... 的按钮时,没有任何反应...

回答 5 投票 0

如何在firebase连接中添加Sweet Alert?

我想在联系表单成功时添加一个SweetAlert,但不知道如何在firebase的angular连接中添加甜蜜提示信息。 contact-service.service.ts import { Injectable } ...

回答 1 投票 0

如何将swal模式中的标题调整为左上角?

嗨,我已经开发的swell模态出现像我想要的输出出现像下面的图像是有反正减少按钮的大小,并把确认文本......

回答 1 投票 0

SweetAlert2与Routify中的$beforeUrlChange:如何在丢失更改之前提示用户?

我想在用户退出页面之前设置一个简单的警告信息,这个方法很好用:$beforeUrlChange((event, store) => { return confirm("Beware! 你将失去你的记录,如果你......

回答 1 投票 0

react限制了渲染的次数

在反应中,我显示的产品我.E.{renderPosts.map((item,index)=>(...现在,在每个产品,有一个按钮,以删除该产品,里面的按钮,我有onclick的...。

回答 1 投票 0

在服务和Inject中定义甜美的警报。

在angularJS2typescript中使用甜美的警报消息。由于其在应用中不止一个地方使用,所以这段代码在很多地方都在重复。创建了一个服务 @Injectable() export ...

回答 1 投票 0

无法从SweetAlert框中选择复制粘贴。

我有一个问题,我不知道如何解决。我正在使用SweetAlert向用户显示一条消息。我想能够选择复制一些下一个,但这似乎并不工作。我的...

回答 1 投票 1

© www.soinside.com 2019 - 2024. All rights reserved.