storage.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <view class="container">
  3. <u-navbar :is-fixed="false" :border-bottom="false" :is-back="true" back-icon-name="arrow-leftward"
  4. back-icon-color="#fff" back-icon-size="35" :background="{ background: 'linear-gradient(90deg, #69b0ff, #5f88ff)' }" title="Storage 操作"
  5. title-color="#fff">
  6. </u-navbar>
  7. <view class="u-demo">
  8. <view class="u-demo-wrap">
  9. <view class="u-demo-title">演示效果</view>
  10. <view class="u-demo-area u-flex u-row-center">
  11. [ BladeX ] 的官网为:{{domain}}
  12. </view>
  13. </view>
  14. <view class="u-config-wrap">
  15. <view class="u-config-title u-border-bottom">参数操作</view>
  16. <view class="u-config-item">
  17. <view class="u-item-title">按钮点击</view>
  18. <u-button @click="modifyStorage">修改变量</u-button>
  19. </view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. domain: ''
  29. }
  30. },
  31. onLoad() {
  32. this.domain = uni.getStorageSync('domain');
  33. },
  34. methods: {
  35. modifyStorage() {
  36. uni.setStorageSync('domain', 'https://bladex.vip');
  37. this.domain = uni.getStorageSync('domain');
  38. }
  39. },
  40. }
  41. </script>