Giter VIP home page Giter VIP logo

larea-cityselect's Introduction

LArea citySelect 省市区联动移动端控件

简易版的移动端省市区联动的选择框,仿ios选择器

更新

纯原生js的移动端城市选择插件,不依赖任何库,演示效果请在移动端或PC浏览器模拟移动端查看效果。 ##使用方法 ###载入 CSS 文件

<link rel="stylesheet" type="text/css" href="css/LArea.css" >
<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />

###DOM底部载入 JavaScript 文件

<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/province.js"></script>
<script type="text/javascript" src="js/LArea1.js"></script>

###DOM 结构

<div class="content-block">
    <input id="demo" type="text" readonly="" placeholder="城市选择特效" value="广东省,深圳市"/>
    <input id="value" type="hidden" value="20,234,504"/>
</div>

###调用 LArea

var area = new LArea();
    area.init({
        'trigger': '#demo', //触发选择控件的文本框,同时选择完毕后name属性输出到该位置
        'valueTo': '#value', //选择完毕后id属性输出到该位置
        'keys': {
            id: 'code',
            name: 'name'
        }, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出
        'type': 1, //数据源类型
        'data': LAreaData //数据源
    });
    area.value=[1,13,3];//控制初始位置,注意:该方法并不会影响到input的value

v2.0.0 省市联动

image

v2.0.0 省市区联动

image

代码会持续优化,如果喜欢望赏颗星。

larea-cityselect's People

Contributors

godshira 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.