Closed xuxiaoxiao312 closed 3 years ago
@xuxiaoxiao312 复现的操作步骤再描述得清晰一些
在npm run dev:weapp 正在运行时的情况下,新增一个indexC页面:
// indexC.jsx
import Taro from '@tarojs/taro'
import React from 'react'
import { View, Text, Button } from '@tarojs/components'
export default class Index extends React.Component {
gotoWxParse() {
Taro.navigateTo({
url: '/pages/wxParse/wxParse'
})
}
gotoEcharts() {
Taro.navigateTo({
url: '/pages/echarts/echarts'
})
}
gotoNative() {
Taro.navigateTo({
url: '/pages/native/native'
})
}
tabEvent(e) {
console.log(e)
}
render() {
return (
<View className='index'>
<tab onMyevent={this.tabEvent} myProperty='This is tab' />
<View className='title'>与小程序原生融合的各种示例</View>
<View className='main'>
<View className='wrapper'>
<Button type='primary' onClick={this.gotoWxParse}>
wxParse 示例
</Button>
</View>
<View className='wrapper'>
<Button type='primary' onClick={this.gotoEcharts}>
echarts-for-weixin 示例
</Button>
</View>
<View className='wrapper'>
<Button type='primary' onClick={this.gotoNative}>
混写原生页面示例
</Button>
</View>
</View>
</View>
)
}
}
// indexC.config.js
export default {
navigationBarTitleText: '首页',
usingComponents: {
tab: '../../components/tab/tab'
}
}
添加到app.config.js
export default {
pages: ['pages/index/index', 'pages/index/publicNumber', 'pages/index/indexC'],
...
此时添加的页面自动编译到dist/,在模拟器上可以看到引入的自定义组件,以及具体的节点信息。 此时ctrl+c退出自动编译的状态,再执行npm run dev:weapp 重新编译整个项目,tab组件就没有了
之前正常的组件,在重新编译之后目前都不可以用了。之前使用的是3.0.18,试验过全面升级到3.2.0还是不行。
@xuxiaoxiao312 复现的操作步骤再描述得清晰一些
麻烦看一下🙇♀️
@xuxiaoxiao312 试了 taro-sample-weapp 这个包,Taro 3.2.0,没有复现。重启一下开发者工具试试吧,同样的代码每次编译的结果应该都是一样的。
如果还有问题,提供一下完整可复现的 demo 吧。
我碰到的问题是在 pages/index/index.config.ts配置的usingComponents无效,在其他页面配置usingComponents是正常的,我把文件夹名称改成home如pages/home/index.config.ts后就正常了,不知道啥原因,难道pages/index比较特殊?
我碰到的问题是在 pages/index/index.config.ts配置的usingComponents无效,在其他页面配置usingComponents是正常的,我把文件夹名称改成home如pages/home/index.config.ts后就正常了,不知道啥原因,难道pages/index比较特殊?
@tianxing0923 这种情况没遇到过,升级到最新版本再试试,如果还有问题可以新开一个 issue,附上完整可复现的 demo。
相关平台
微信小程序
小程序基础库: 2.1.5.0 使用框架: React
复现步骤
taro 3.2.0引入自定义组件后重新编译下自定义节点就无效了。直接拷贝的taro-sample-weapp的index页面,拷贝过来后自动编译后是有正确的节点。npm run dev:weapp 重新编译后节点内容消失。
此处是自动编译后的页面节点情况:
此处是重新编译后的页面节点情况
期望结果
正确引入自定义组件
实际结果
无法正确引入自定义组件
环境信息