wtt
2025-08-12 112bb1d3ca7e5c813adc9514f6b56b5e4886f49b
pages/index/tab1.vue
@@ -26,10 +26,13 @@
</template>
<script>
   import { CommonUtils } from '../../utils/common'
   import { setMenuList, getMenuList } from '../../utils/menuListApp'
   export default {
      data() {
         return {
            menuListRowName: 'tab1',
            updateCount: 0,
            menuListName: 'tab1',
            canEdit: false,
            serverUrl: uni.getStorageSync('serverUrl') || 'http://47.96.97.237/API',
            itemData: [{
@@ -232,22 +235,34 @@
         this.getHiddenItem()
      },
      methods: {
         getHiddenItem() {
            let itemCache = uni.getStorageSync('HTab1ItemData') || ''
            console.log('itemCache: ', itemCache);
            if (itemCache !== '') {
               this.itemData = itemCache
            }
         async getHiddenItem() {
            // let itemCache = uni.getStorageSync('HTab1ItemData') || ''
            // console.log('itemCache: ', itemCache);
            // if (itemCache !== '') {
            //    this.itemData = itemCache
            // }
            let data = await getMenuList({
               menuName: this.menuListName
            })
            Array.from(data).forEach(e => {
               this.itemData[e["HIndex"]].hidden = !CommonUtils.stringToBoolean(e["HShowMode"])
            })
         },
         switchHidden(index) {
            console.log(this.itemData[index].hidden)
            this.updateCount ++;
            this.itemData[index].hidden = !this.itemData[index].hidden
         },
         switchIconsModeHandler() {
            this.canEdit = !this.canEdit
            if (this.canEdit == false) {
            if(this.canEdit == false && this.updateCount > 0) {
               this.$nextTick(() => {
                  uni.setStorageSync("HTab1ItemData", this.itemData)
                  // uni.setStorageSync("HIndexItemData", this.itemData)
                  setMenuList({
                     menuName: this.menuListName,
                     payload: this.itemData
                  })
                  this.updateCount = 0
               })
            }
            this.$forceUpdate()