Giter VIP home page Giter VIP logo

zhilin-cascader's Introduction

使用方法

1.HBuilderX导入:直接在template组件中使用 2.使用npm安装: npm i zhilin-cascader import ZhilinCascader from 'zhilin-cascader/zhilin-cascader'

    const options = [
        {
            value: 'zhejiang',
            label: 'Zhejiang',
            children: [{
                value: 'hangzhou',
                label: 'Hangzhou',
                children: [{
                    value: 'xihu',
                    label: 'West Lake',
                }]
            }]
        },
        {
            value: 'jiangsu',
            label: 'Jiangsu',
            children: [{
                value: 'nanjing',
                label: 'Nanjing',
                children: [{
                    value: 'zhonghuamen',
                    label: 'Zhong Hua Men',
                }]
            }]
        }
    ]
    export default {
        data() {
            return {
                options,
                show: true
            }
        },
        methods: {
            onConfirm(value) {
                console.log(value)
            }
        }
    }

直接在 template 中使用组件

<zhilin-cascader
        v-model="show"
        :options="options"
        @confirm="onConfirm"
>
</zhilin-cascader>

属性说明

属性名 类型 必填 默认值 说明
v-model Boolean 控制选择器弹出/隐藏
options Array/ObjectArray 格式:[{label:"四川",value:"sc",children:[]}]
title String "请选择" 选择器的标题
isFullValue Boolean false 是否限制选择完每一项才能confirm
defaultSelected Array 初始选中项(必须与options数据value对应)
fieldNames Object {label:'label',value:'value',children:'children'} 自定义options中label value children的字段
height String 根据设备自适应 需要带上相应单位

事件说明

事件名 说明 返回值
change 选中项发生改变时触发 接收当前选中项value,数组
confirm 点击确定时触发 接收当前选中项value,数组

zhilin-cascader's People

Contributors

lucklin520 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.