admin 发表于 2023-2-16 18:54:57

WX小程序中,使用wx.showToast 和 wx.showMdal

<div id="article_content" class="article_content clearfix">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-6e43165c0a.css">
                <div id="content_views" class="htmledit_views">
                  <p>在小程序中使用wx.showToast语法结构</p>
<p>在 onload中去触控产生执方法&#xff1a;</p>
<blockquote>
<p>wx:showToast({</p>
<p>        title:'成功'&#xff0c;</p>
<p>        icon:'success',</p>
<p>        duration:2000</p>
<p>}),</p>
</blockquote>
<h1 id="wx-showToast-Object-object">wx.showToast(Object object)</h1>
<blockquote>
<p><strong>以 <ahref="https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/api.html#%E5%BC%82%E6%AD%A5-API-%E8%BF%94%E5%9B%9E-Promise">Promise 风格</a> 调用</strong>&#xff1a;支持</p>
<p><strong>小程序插件</strong>&#xff1a;支持&#xff0c;需要小程序基础库版本不低于 <ahref="https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html">1.9.6</a></p>
</blockquote>
<p>显示消息提示框</p>
<h2 id="参数">参数</h2>
<h3 id="Object-object">Object object</h3>
<table><thead><tr><th>属性</th><th>类型</th><th>默认值</th><th>必填</th><th>说明</th><th>最低版本</th></tr></thead><tbody><tr><td>title</td><td>string</td><td></td><td>是</td><td>提示的内容</td><td></td></tr><tr><td>icon</td><td>string</td><td>success</td><td>否</td><td>图标</td><td></td></tr><tr><td>image</td><td>string</td><td></td><td>否</td><td>自定义图标的本地路径&#xff0c;image 的优先级高于 icon</td><td><ahref="https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html">1.1.0</a></td></tr><tr><td>duration</td><td>number</td><td>1500</td><td>否</td><td>提示的延迟时间</td><td></td></tr><tr><td>mask</td><td>boolean</td><td>false</td><td>否</td><td>是否显示透明蒙层&#xff0c;防止触摸穿透</td><td></td></tr><tr><td>success</td><td>function</td><td></td><td>否</td><td>接口调用成功的回调函数</td><td></td></tr><tr><td>fail</td><td>function</td><td></td><td>否</td><td>接口调用失败的回调函数</td><td></td></tr><tr><td>complete</td><td>function</td><td></td><td>否</td><td>接口调用结束的回调函数&#xff08;调用成功、失败都会执行&#xff09;</td><td></td></tr></tbody></table>
<p><strong>object.icon 的合法值</strong></p>
<table><thead><tr><th>值</th><th>说明</th><th>最低版本</th></tr></thead><tbody><tr><td>success</td><td>显示成功图标&#xff0c;此时 title 文本最多显示 7 个汉字长度</td><td></td></tr><tr><td>error</td><td>显示失败图标&#xff0c;此时 title 文本最多显示 7 个汉字长度</td><td></td></tr><tr><td>loading</td><td>显示加载图标&#xff0c;此时 title 文本最多显示 7 个汉字长度</td></tr></tbody></table>
<p></p>
<p></p>
<p></p>
                </div>
      </div>
      <div id="treeSkill"></div>
页: [1]
查看完整版本: WX小程序中,使用wx.showToast 和 wx.showMdal