Giter Club home page Giter Club logo

bz-area's Introduction

播种网移动端省市区模块,UI基于em设计

命令

npm run dev
npm run build
npm run build:dist
npm run build:moe
npm run eslint

使用

Using require.js

require(['mod/bz-area/0.0.1/bz-area'], function (BzArea) {
  var bzArea = new BzArea({
    title: '所在地区',
    level: 3,
  });
  bzArea.on('success', (data) => {
    console.log(data);
  });
});

Using npm

npm install https://github.com/BozhongFE/bz-area#v0.0.1
import BzArea from 'bz-area';
const bzArea = new BzArea({
  level: 2,
  format: data => data.map(item => item.name), 
});
bzArea.on('success', (data) => {
  console.log(data);
});

配置参数

new BzArea(options)

options

参数名 类型 描述
title String 模块顶部标题
level Number 地区级别,共4级(省、市、区、街道),默认:3
format Function 选完回调success前对数据进行格式化处理,并返回

实例方法

show

显示模块

bzArea.show();

hide

关闭模块

bzArea.hide();

on

添加各个类型回调事件

bzArea.on(type, callback);
参数 描述
type 事件类型:success成功回调(可在options.format预先格式化数据))、hide关闭模块回调
callback 对应的回调事件

set

设置地区的值

bzArea.set(area);
参数 描述
area 设置的地区值(Array),例如:['广东省', '广州市']

destroy

销毁实例

bzArea.destroy();

展示图

bz-area's People

Contributors

unclay avatar

Watchers

James Cloos 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.