Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react按照文档配置后,用小程序第三方组件报错,在页面配置中注册也不行 #7117

Closed
zh925 opened this issue Jul 21, 2020 · 4 comments
Labels
V-3 Version - 3.x

Comments

@zh925
Copy link

zh925 commented Jul 21, 2020

相关平台

微信小程序

复现仓库

https://github.com/zh925/taro-f2-component-demo
小程序基础库: 2.11.2
使用框架: React

复现步骤

在index.config.ts配置usingComponents后,使用小程序第三方组件

期望结果

不报错,正常渲染

实际结果

报错并且没有正常渲染

VM143:1 ./base.wxml
 Template `tmpl_7_chart` not found.
  2819 | 
  2820 | <template name="tmpl_7_container" data="{{i: i}}">
> 2821 |   <template is="{{'tmpl_7_'   i.nn}}" data="{{i: i}}" />
       |                ^
  2822 | </template>
  2823 | 
  2824 | <template name="tmpl_8_view">

环境信息

  Taro CLI 3.0.5 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 12.14.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.4 - C:\Users\86176\AppData\Roaming\npm\yarn.CMD
      npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD
@zEmily
Copy link

zEmily commented Jul 28, 2020

我也出现同样的情况

我是从 Taro 2 迁移到 Taro Next,之前在Taro 2 整个程序都运行的很好。迁移过程中发现按照官方文档使用 index.config.js 也没能成功引用 vant-weapp。

index.config.js

export default {
  usingComponents: {
    'van-icon': '../vant-weapp/icon/index',
  },
}

warn 信息

VM6474:1 ./base.wxml
 Template `tmpl_12_van-icon` not found.
  4527 | 
  4528 | <template name="tmpl_12_container" data="{{i: i}}">
> 4529 |   <template is="{{'tmpl_12_' + i.nn}}" data="{{i: i}}" />
       |                ^
  4530 | </template>
  4531 | 
  4532 | <template name="tmpl_13_view">

环境信息

👽 Taro v3.0.0-rc.6


  Taro CLI 3.0.0-rc.6 environment info:
    System:
      OS: macOS 10.14.6
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 10.19.0 - ~/.nvm/versions/node/v10.19.0/bin/node
      Yarn: 1.3.2 - ~/.yarn/bin/yarn
      npm: 6.13.4 - ~/.nvm/versions/node/v10.19.0/bin/npm
    npmPackages:
      @tarojs/components: ^3.0.0-rc.6 => 3.0.0-rc.6
      @tarojs/mini-runner: ^3.0.0-rc.6 => 3.0.0-rc.6
      @tarojs/react: ^3.0.0-rc.6 => 3.0.0-rc.6
      @tarojs/router: 2.1.1 => 2.1.1
      @tarojs/runtime: ^3.0.0-rc.6 => 3.0.0-rc.6
      @tarojs/taro: ^3.0.0-rc.6 => 3.0.0-rc.6
      @tarojs/taro-h5: 2.1.1 => 2.1.1
      @tarojs/webpack-runner: ^3.0.0-rc.6 => 3.0.0-rc.6
      babel-preset-taro: ^3.0.0-rc.6 => 3.0.0-rc.6
      eslint-config-taro: ^3.0.0-rc.6 => 3.0.0-rc.6
      eslint-plugin-taro: 2.1.1 => 2.1.1
      nerv-devtools: ^1.5.6 => 1.5.6
      nervjs: ^1.5.6 => 1.5.6
      react: ^16.13.1 => 16.13.1
      taro-ui: ^3.0.0-alpha.3 => 3.0.0-alpha.3

@zEmily
Copy link

zEmily commented Jul 28, 2020

#5477

@Chen-jj Chen-jj added the V-3 Version - 3.x label Aug 6, 2020
@Chen-jj Chen-jj added this to the 3.0.8 milestone Aug 6, 2020
@luckyadam
Copy link
Member

https://github.com/NervJS/taro3-vant-sample
参考一下这个项目

@Chen-jj Chen-jj modified the milestones: 3.0.8, 3.0.9 Aug 18, 2020
@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 1, 2020

@zh925 你的 usingComponents 配置写错地方了,组件没有 xx.config.js 这个配置文件,你应该写在页面的配置文件中。

image

image

@Chen-jj Chen-jj closed this as completed Sep 1, 2020
@Chen-jj Chen-jj removed this from the 3.0.9 milestone Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

4 participants