taro icon indicating copy to clipboard operation
taro copied to clipboard

vant-weapp area组件内容不显示。

Open Michaels-bot opened this issue 7 years ago • 7 comments

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;

Michaels-bot avatar Jan 25 '19 06:01 Michaels-bot

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

taro-bot avatar Jan 25 '19 07:01 taro-bot

你 render 的代码没写

yuche avatar Jan 25 '19 09:01 yuche

代码再贴全一点吧

luckyadam avatar Jan 25 '19 10:01 luckyadam

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 (<van-areavalue="110101"columns-num={3}area-list={provinceList}/>)}}export default Index;

Michaels-bot avatar Jan 26 '19 03:01 Michaels-bot

你代码都粘一块了,眼镜都要看瞎了

yuche avatar Jan 26 '19 16:01 yuche

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 那样,把数据文件做成动态加载

luckyadam avatar Jan 27 '19 15:01 luckyadam

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

taro-bot avatar Jan 27 '19 15:01 taro-bot