子组件
props:{
type:'count' | 'time'
}
调用
<component type='count'/> //正确
const a='count'
<component type={a}/>// 错误 无法将string类型赋予 count | time
这个问题该如何解决 type 是动态的
子组件
props:{
type:'count' | 'time'
}
调用
<component type='count'/> //正确
const a='count'
<component type={a}/>// 错误 无法将string类型赋予 count | time
这个问题该如何解决 type 是动态的
4 回答1.6k 阅读
2 回答1k 阅读✓ 已解决
2 回答2.6k 阅读
1 回答940 阅读✓ 已解决
1 回答670 阅读✓ 已解决
2 回答830 阅读✓ 已解决
2 回答988 阅读
指定类型:
嫌啰嗦可以写个
type
: