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

自定义原生组件不能传props? #10463

Open
MrQinYQ opened this issue Oct 20, 2021 · 2 comments
Open

自定义原生组件不能传props? #10463

MrQinYQ opened this issue Oct 20, 2021 · 2 comments
Labels
F-react Framework - React T-feishu V-3 Version - 3.x

Comments

@MrQinYQ
Copy link

MrQinYQ commented Oct 20, 2021

相关平台

飞书小程序

使用框架: React

复现步骤

src/page/index/index.config.js

export default {
  enablePullDownRefresh: true,
  navigationBarTitleText: 'XXX',
  usingComponents: {
    'verification': '../../libs/captcha/verification/index'
  }
}

src/page/index/index.js

render() {
return <Block>
<verification
            aid="6249"
            fp={fp}
            region="cn"
            host={host}
            verifyData={testData}
            onClose={() => console.log('onclose')}
            onSuccess={() => console.log('onsuccess')}
            onFail={() => console.log('onfail')}
          ></verification>
</Block>
}

dist/base.ttml

<template name="tmpl_0_verification">
  <verification  id="{{i.uid}}">
    <block tt:for="{{i.cn}}" tt:key="uid">
      <template is="tmpl_0_container" data="{{i:item}}" />
    </block>
  </verification>
</template>

期望结果

传入props成功

实际结果

编译后的verification,并没有用到i中的参数,导致传入的props全部失败?

环境信息

👽 Taro v3.3.9


  Taro CLI 3.3.9 environment info:
    System:
      OS: macOS 11.6
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.15.5 - ~/Documents/learning/emsdk/node/14.15.5_64bit/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v14.16.0/bin/yarn
      npm: 6.14.11 - ~/Documents/learning/emsdk/node/14.15.5_64bit/bin/npm
    npmPackages:
      @tarojs/components: 3.3.9 => 3.3.9
      @tarojs/mini-runner: 3.3.9 => 3.3.9
      @tarojs/react: 3.3.9 => 3.3.9
      @tarojs/runtime: 3.3.9 => 3.3.9
      @tarojs/taro: 3.3.9 => 3.3.9
      @tarojs/webpack-runner: 3.3.9 => 3.3.9
      @tarojs/with-weapp: ^3.3.9 => 3.3.9
      babel-preset-taro: 3.3.9 => 3.3.9
      eslint-config-taro: 3.3.9 => 3.3.9
      react: ^17.0.0 => 17.0.2
@miduoN
Copy link

miduoN commented Dec 3, 2021

亲 怎么解决了呢,我也碰到这个问题, 方法传不进去

@pillys
Copy link

pillys commented Dec 21, 2021

遇到同样的问题,编译的时候属性消失

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-feishu V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

3 participants