欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序wxml不能使用Array.includes條件判斷解決方法

 更新時(shí)間:2023年11月20日 10:23:19   作者:旅圖灬  
這篇文章主要為大家介紹了微信小程序wxml不能使用Array.includes條件判斷解決方法,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

僅支持es5

有點(diǎn)坑,僅支持es5的一些方法如圖

想要使用includes功能的話,只能使用小程序提供的模塊功能,見文檔
https://developers.weixin.qq.com/miniprogram/dev/reference/wx...

自己聲明一個(gè)。如下,utils.js里面用some實(shí)現(xiàn)了個(gè)includes方法

function includes(a,b) {
  return a.some(function(e){
    return e === b
  })
}
module.exports = {
  includes: includes,
}

然后再在我的wxml文件里面引入

<wxs module="utils" src="./utils.wxs" />
<block wx:if="{{utils.includes(a,b)}}">
</block>

以上就是微信小程序wxml不能使用Array.includes條件判斷的詳細(xì)內(nèi)容,更多關(guān)于微信小程序wxml不能使用Array.includes條件判斷的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論