zoukankan      html  css  js  c++  java
  • vant 级联选择器跳坑

    <van-field readonly clickable name="calendar" :value="area" label="户籍区划" required placeholder=""
                            @click="cityShow = true">
                        </van-field>
     
    <van-popup v-model="cityShow" position="bottom">
                    <van-picker @cancel="cityShow = falase" show-toolbar :columns="areaList" @confirm="confirmCity">
                    </van-picker>
                </van-popup>
     
    setarr(item) {
                        if (!item.children) {
                            item.text = item.name
                            return item
                        } else {
                            item.text = item.name
                            item.children.forEach((sitem, sindex) => {
                                item = this.setarr(sitem)
                            })
                            return item
                        }
                    },

                    getareaList() {
                        var self = this;
                        let content = {
                            fun: 'get_base_addr'
                        }
                        axios.get('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', {
                                params: content
                            })
                            .then(function (response) {
                                self.loading = false;
                                console.log(response.data.result);
                                response.data.result.forEach((item, index) => {
                                    item = self.setarr(item)
                                })
                                console.log(1111, response.data.result)
                                self.areaList = response.data.result

                            })
                            .catch(function (error) {
                                self.loading = false;
                            });
                    },
     
    注意vantjs的引入版本 必须在2.4.5以上才能生效
  • 相关阅读:
    图的应用详解-数据结构
    图的遍历
    node.js基础模块http、网页分析工具cherrio实现爬虫
    NodeJS制作爬虫全过程
    Nodejs爬虫进阶教程之异步并发控制
    asp.net的临时文件夹
    Cms WebSite 编译非常慢
    查看数据库的表被谁锁住了,以及如何解锁
    WinRar 设置默认的压缩格式为zip
    Can not Stop-Computer in powershell 6.0
  • 原文地址:https://www.cnblogs.com/jclonely/p/14513426.html
Copyright © 2011-2022 走看看