收藏
回答

微信小商店首页如何使用交易组件首页?

各位大侠,我按照官方的文件,将代码提交到小程序,其它都正常,就是首页是hello world的界面,如何修改能实现官方文件上的首页界面,或者是使用这种店铺装修模板可以让首页也被装修?谢谢!

// index.js
// 获取应用实例
const app = getApp()


Page({
  data: {
    motto'Hello World',
    userInfo: {},
    hasUserInfofalse,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    canIUseGetUserProfilefalse,
    canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'// 如需尝试获取用户信息可改为false
  },
// 事件处理函数
  bindViewTap() {
    wx.navigateTo({
      url'../logs/logs'
    })
  },
  onLoad() {
    if (wx.getUserProfile) {
      this.setData({
        canIUseGetUserProfiletrue
      })
    }
  },
  getUserProfile(e) {
    // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
    wx.getUserProfile({
      desc'展示用户信息'// 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
      success(res) => {
        console.log(res)
        this.setData({
          userInfo: res.userInfo,
          hasUserInfotrue
        })
      }
    })
  },
  getUserInfo(e) {
    // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
    console.log(e)
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfotrue
    })
  }
})
const productId = [商品id] // 填写具体的商品Id


    wx.navigateTo({


          url`plugin-private://wx34345ae5855f892d/pages/productDetail/productDetail?productId=${productId}`,
  
    });
回答关注问题邀请回答
收藏

1 个回答

  • 微信小商店社区答疑
    微信小商店社区答疑
    2023-06-21

    建议直接微信搜腾讯客服咨询下看看哈(多输入几次人工客服,在线客服触发人工接入)

    2023-06-21
    有用
    回复
登录 后发表内容