收藏
回答

在项目中使用组件store-product报错?

项目是 Taro + React + TypeScript 小程序项目

代码位置

<View
      className={`bg-white rounded-lg overflow-hidden mb-4 ${className}`}
      style={{ minHeight: "200rpx" }}
    >
      {/* @ts-ignore */}
      <store-product
        appid={product.shopAppid}
        product-id={product.wechatProductId}
        onEntererror={handleEnterError}
        onEntersuccess={handleEnterSuccess}
        custom-content
        style={{ display: "block", width: "100%", height: "100%" }}
      >
        <View className="flex gap-4 p-5">
        {/* 商品图片 */}
        <View className="w-[200rpx] h-30 shrink-0">
          <RemoteImage
            src={product.coverImage}
            mode="aspectFill"
            className="w-full h-full rounded-lg"
            lazyLoad
          />
        </View>


        {/* 商品信息 */}
        <View className="flex-1 flex flex-col h-30">
          {/* 商品名称 */}
          <Text className="text-title font-semibold mt-[10rpx] block text-30">
            {product.productName}
          </Text>


          {/* 商品类型 */}
          {product.productCategory && (
            <Text className="text-content  mt-[10rpx] block text-26">{product.productCategory}</Text>
          )}


          {/* 商品描述 */}
          <Text className="text-content mt-[10rpx] block text-26">
            {product.productDesc}
          </Text>
          {/* 价格和详情链接 */}
          <View className="flex items-center justify-between mt-auto mb-[10rpx]">
            <Price price={product.priceMoney} size="normal" thousands />
            <Text className="text-24 text-primary" >
              详情 »
            </Text>
          </View>
        </View>
      </View>
      {/* @ts-ignore */}
      </store-product>

入口配置

plugins: {
    "mini-shop-plugin": {
      "version": "1.8.19",
      "provider": "wx34345ae5855f892d",
    },
  },
  usingComponents: {
    "store-product": "plugin://mini-shop-plugin/store-product",
  },
  "rendererOptions": {
    "skyline": {
    "defaultDisplayBlock": true,
    "disableABTest": true,
    "sdkVersionBegin": "3.0.1",
    "sdkVersionEnd": "15.255.255"
    }
  },
  "style": "v2",
  "componentFramework": "glass-easel",
  lazyCodeLoading: "requiredComponents",

回答关注问题邀请回答
收藏

2 个回答

  • 贝克尔街地森林
    贝克尔街地森林
    星期日 09:12

    星期日 09:12
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    星期日 09:10
    有用
    回复 1
    • 贝克尔街地森林
      贝克尔街地森林
      星期日 09:12
      进入项目就开始报错
      星期日 09:12
      回复
登录 后发表内容