相关平台
微信小程序
复现仓库
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未获取到
1条答案
按热度按时间f45qwnt81#
请问项目目录中的miniprogram文件夹是如何来的