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

使用微信小程序插件开发模式,插件中的自定义组件无法进行组件配置(multipleSlots等) #15715

Open
kaixuanzhou opened this issue May 13, 2024 · 0 comments
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@kaixuanzhou
Copy link

相关平台

微信小程序

复现仓库

https://github.com/kaixuanzhou/taro-test-build-plugin.git
小程序基础库: 3.4.0
使用框架: React

复现步骤

在插件中导出一个自定义组件,用官方文档中的写法,尝试对插件中的组件进行配置多插槽模式时失效

使用taro仓库中的build-weapp-plugin示例,简单改造即可重现
component:

export default class Avatar extends Component {
  static options = {
    multipleSlots: true,
  }

  render () {
    return (
      <View >
        <Text>slot 1:</Text>
        <NativeSlot name='slot1' />
        <Text>slot 2:</Text>
        <NativeSlot name='slot2' />
      </View>
    )
  }
}

page:


export default class Index extends Component {
  render () {
    return (
      <View className='index'>
        {/** 测试插件组件 */}
        <avatar>
          <Slot name='slot1'>测试slot1</Slot>
          <Slot name='slot2'>测试slot2</Slot>
          </avatar>


      </View>
    )
  }
}

期望结果

能正常使用多插槽模式

实际结果

多插槽无效,改成单插槽模式可显示

环境信息

build-weapp-plugin@1.0.0 info
> taro info

👽 Taro v3.6.24


  Taro CLI 3.6.24 environment info:
    System:
      OS: macOS 12.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 16.20.2 - /opt/homebrew/opt/nvm/versions/node/v16.20.2/bin/node
      Yarn: 1.22.17 - /opt/homebrew/bin/yarn
      npm: 8.19.4 - /opt/homebrew/opt/nvm/versions/node/v16.20.2/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.24 => 3.6.24 
      @tarojs/components: 3.6.24 => 3.6.24 
      @tarojs/plugin-framework-react: 3.6.24 => 3.6.24 
      @tarojs/react: 3.6.24 => 3.6.24 
      @tarojs/runtime: 3.6.24 => 3.6.24 
      @tarojs/taro: 3.6.24 => 3.6.24 
      @tarojs/webpack5-runner: 3.6.24 => 3.6.24 
      babel-preset-taro: 3.6.24 => 3.6.24 
      eslint-config-taro: 3.6.24 => 3.6.24 
      react: ^18.0.0 => 18.2.0 
    npmGlobalPackages:
      typescript: 5.4.5

补充信息

有尝试在源码中定位问题,发现:taro/native-component.js中读取组件的config未获取到

@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Status: Todo
Development

No branches or pull requests

1 participant