微信小程序 功能函数 把数字1,2,3,4换成春,夏,秋,冬
生活随笔
收集整理的這篇文章主要介紹了
微信小程序 功能函数 把数字1,2,3,4换成春,夏,秋,冬
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
let season =‘1,2,3’; // console.log(season.length) if (season){ if (season.length==1){ seasonChe1=season.substr(0); seasonChe1 = parseInt(seasonChe1) switch (seasonChe1) { case 1: (function(){ seasonChe2='春' })() break; case 2: (function () { seasonChe2 = '夏' })() break; case 3: (function () { seasonChe2 = '秋' })() break; default: (function () { seasonChe2 = '冬' })() } }else{ seasonChe1 = season.split(","); for (let i = 0; i<seasonChe1.length;i++){ let che=''; che=seasonChe1[i]; che = parseInt(che) switch (che) { case 1: (function () { seasonChe1[i]= '春' })() break; case 2: (function () { seasonChe1[i] = '夏' })() break; case 3: (function () { seasonChe1[i] = '秋' })() break; default: (function () { seasonChe1[i]= '冬' })() } } seasonChe2 = seasonChe1.join(",") } } item.season = seasonChe2 that.setData({ detailDatas: item })
轉載于:https://www.cnblogs.com/dianzan/p/7997601.html
總結
以上是生活随笔為你收集整理的微信小程序 功能函数 把数字1,2,3,4换成春,夏,秋,冬的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 怀孕初期梦到下雨有什么预示
- 下一篇: PM2.5空气质量指数(AQI)是如何计