Taro + TS 开发小程序,原生组件声明,IDE报错

组件引用

export default {
  navigationBarTitleText: '首页',
  usingComponents:{
    "test":"../../weapp-components/Test/index"
  }
}

tsx 声明

render () {
    return (
      <View className='home'>
        <Image src={headerImg} mode="widthFix" className="wImg"></Image>
        <test></test>  
      </View>
    )
  }

test 组件报错,Property 'test' does not exist on type 'JSX.IntrinsicElements'

阅读 2.9k
1 个回答
//global.d.ts
declare namespace JSX{
    interface IntrinsicElements{
        'test':any
    }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Microsoft
子站问答
访问
宣传栏