let name = '/pages/my/My'
//将定义好的值存入到数组中
this.value.push(name)
console.log(this.value)
//将数组的最后一位取出
console.log(this.value.slice(-1)[0])
//删除数组最后一位
this.value.pop()
console.log(this.value)
路径跳转
uni.switchTab({
url: name
})
//将数组转JSON存储到session中
let aaa = ["ddd","aaa"]
let items = JSON.stringify(aaa);
uni.setStorageSync("wqzdy" , items);
//将session中存储的数组取出
var data = uni.getStorageSync("wqzdy" );
var item = JSON.parse(data)
console.log(item)
JS向数组存储String类型数据,截取最后一位数据,删除最后一位数据。
于 2023-08-24 14:38:58 首次发布