vant-weapp area组件内容不显示。
import Taro, { Component } from '@tarojs/taro' import { View, Button, Text } from '@tarojs/components' import provinceList from "../../utils/province"; import './index.scss'
class Index extends Component {
config = {
navigationBarTitleText: '首页',
usingComponents: {
"van-area": "../../components/vant/area/index"
}
}
componentWillReceiveProps (nextProps) { console.log(this.props, nextProps) }
componentWillUnmount () { }
componentDidShow () { }
componentDidHide () { }
render () {
return (
export default Index;
欢迎提交 Issue~
如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏
如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。
Good luck and happy coding~
你 render 的代码没写
代码再贴全一点吧
import Taro, { Component } from '@tarojs/taro'import { View, Button, Text } from '@tarojs/components'import provinceList from "../../utils/province";import './index.scss'class Index extends Component {config = {navigationBarTitleText: '首页',usingComponents: {"van-area": "../../components/vant/area/index"}}componentWillReceiveProps (nextProps) {console.log(this.props, nextProps)}componentWillUnmount () { }componentDidShow () { }componentDidHide () { }render () {return (
你代码都粘一块了,眼镜都要看瞎了
import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text } from '@tarojs/components'
import provinceList from '../../utils/province'
class Index extends Component {
config = {
navigationBarTitleText: '首页',
usingComponents: {
'van-area': '../../components/vant/area/index'
}
}
state = {
areaList: {}
}
componentWillReceiveProps (nextProps) {
console.log(this.props, nextProps)
}
componentDidMount () {
this.setState({
areaList: provinceList
})
}
componentDidShow () { }
componentDidHide () { }
render () {
return (
<van-area value='110101' columns-num={3} area-list={areaList} />
)
}
}
export default Index
改成动态设置吧,看了下 vant 的代码,直接设置不能生效,而且为了减少小程序大小,最好像 vant 的 demo 那样,把数据文件做成动态加载
Hello~
您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。
如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。
Good luck and happy coding~