iT邦幫忙

0

JS filter 查詢

  • 分享至 

  • xImage
  •  

(1)數字查詢
Html
https://ithelp.ithome.com.tw/upload/images/20200624/20127875KzmWstTkDo.jpg
JS Data
https://ithelp.ithome.com.tw/upload/images/20200624/201278759V7iKg7hdy.jpg

JS filter用法

1.先獲取Html Dom
2.https://ithelp.ithome.com.tw/upload/images/20200624/20127875X4yQYxFBFB.jpg

2.JS filter寫判斷式篩選
https://ithelp.ithome.com.tw/upload/images/20200624/20127875mzbJaK6D2E.jpg

開始把結果渲染到頁面
https://ithelp.ithome.com.tw/upload/images/20200624/201278752apVrc4hKK.jpg
https://ithelp.ithome.com.tw/upload/images/20200624/20127875uAbBgyxb1K.jpg

頁面結果
https://ithelp.ithome.com.tw/upload/images/20200624/20127875B3VGr5Ydg1.jpg

(2)文字查詢
如果查詢數組中唯一的元素,用some(Boolean)方法更加合適就不再循環,更有效率

https://ithelp.ithome.com.tw/upload/images/20200624/2012787507UEiJPoIE.jpg
https://ithelp.ithome.com.tw/upload/images/20200624/201278756noQYESCIH.jpg
https://ithelp.ithome.com.tw/upload/images/20200624/20127875ks0789jkNy.jpg


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言