关于wx.clearStorage()与wx.removeStorage()
wx.clearStorage()清除所有的
wx.removeStorage()清除指定的
<template>
<view>
<view class="" style="text-align: center;">
{{cc}}
</view>
<view class="" style="display: flex; justify-content: center; ">
<view class="" @click="add" style="margin-right: 10vw;">
加
</view>
<view @click="clear" class="">
清除
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
cc: 1
}
},
methods: {
add() {
++this.cc
wx.setStorageSync('cc', this.cc)
wx.setStorageSync('bb', this.cc)
},
clear() {
this.cc = 0
wx.removeStorage({
key: 'cc'
})
// wx.clearStorage()
}
}
}
</script>