绿满眶商城微信小程序-uniapp
zxl
2025-07-30 61032da9f6f840c9c96af090d1810bc7a0734f4b
pages/product/goods.vue
@@ -497,7 +497,24 @@
    this.productRefHeight = windowHeight - bottomHeight + "px";
  },
  async onLoad (options) {
     if(options.q){
        let queryParam = null;
        const decodedUrl = decodeURIComponent(decodeURIComponent(option.q));
        console.log('原始URL:', decodedUrl);
        const params = this.parseUrlParams(decodedUrl);
        const id = params.id;
        const gooodsId = params.goodsId;
        queryParam.id = id;
        queryParam.goodsId = gooodsId;
        this.routerVal = queryParam;
     }else{
    this.routerVal = options;
     }
     console.log('打印信息')
      console.log(options)
     console.log(this.routerVal)
    // #ifdef MP-WEIXIN
    // 小程序默认分享
    uni.showShareMenu({
@@ -522,6 +539,23 @@
  },
  methods: {
     // 解析URL参数
     parseUrlParams(url) {
       const params = {};
       // 处理可能存在的hash(如果有的话)
       const cleanUrl = url.split('#')[0];
       const queryStr = cleanUrl.split('?')[1] || '';
       queryStr.split('&').forEach(pair => {
         const [key, value] = pair.split('=');
         if (key) {
           // 如果值存在,则解码,否则设为空字符串
           params[key] = value ? decodeURIComponent(value) : '';
         }
       });
       return params;
     },
    // 重新打开下架
    reStartTakeDownSale(){
      this.$refs.takeDownSale.show = true