Native js implements code sharing at the provincial, municipal, and municipal levels,

Source: Internet
Author: User

Native js implements code sharing at the provincial, municipal, and municipal levels,

Preface

The plug-in function only meets our business needs. If you want more functions, leave a message below and try to extend it as much as possible! If you need or like it, you can give me a star on github.

Preparation

<div id="wrap"></div>

There is no limit on the container labels on the page. You only need to give an id.

var address = new Address({  wrapId: 'wrap',  showArr: ['provinces','citys','areas'],  beforeCreat:function(){    console.log("beforeCreat")  },  afterCreat:function(){    console.log('afterCreat');  }})
WrapId: "wrap" // here, the wrap is the id showArr of the above container: ['provinces ', 'citys ', 'areas'] // The container id of the province, city, and district respectively.

For example, if the passed Array['provinces','citys','areas']If the length is 3, the province and city are displayed. The three strings in the array are the container IDs of the province, city, and district respectively.

For example, the passed Array['provinces','citys']If the length is 2, the province and city are displayed. The two strings in the array are respectively the province and city container IDs.

For example, if the length of an array is 1, you can leave it empty.

beforeCreatCallback Function executed before the plug-in is created

afterCreatCallback Function executed after the plug-in is created

Preview

Summary

If you have any functions to add, you can leave a message in the comment area. I will try my best to satisfy them. If you have any negligence or errors, I hope you can point them out. I will modify it as soon as possible to avoid misleading others.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.