Detailed explanation of the steps to use the vue region selection component

php中世界最好的语言
Release: 2018-05-14 10:09:45
Original
2194 people have browsed it

This time I will bring you a detailed explanation of the steps for using the vue region selection component. What are theprecautionsfor using the vue region selection component? Here are practical cases, let’s take a look.

Overview

is mainly used for the operation of regional data across the country, including linkage at the provincial, municipal and district levels, the addition anddeletion of regional data; When operating regional data, we have used tree-shaped region selection components before, but because the rendering was slow when operating a large amount of regional data, we changed to another data display form and interaction form, thus achieving With this component.

Note: This component is a vue.js component

demo

Please click here for early access demo

API

Props

##Parameters Type Description ##area Events
Array The data of the area passed into the component

##Event Name Description ##selected area Detailed description
Parameters
The area selected in the component
Props

area

area parameter is required and represents the region data when the component is initialized. It can be empty. area is anarraycontaining multiple objects. The data structure of each object is as follows:

... area: [ {Name: '北京', ID: '01'}, {Name: '南京', ID: '0401'}, {Name: '西湖区', ID: '060105'} ], ...
Copy after login

Because later in actual use, I found that sometimes, the background only returns one area. ID value, so optimization has been done here, you can only pass in the ID value, for example:

selected

selected is an event published internally by the component , you can subscribe to this event outside the component to get the value it returns. This value is all the areas currently selected by the component. The returned value is an array composed of multiple objects containing area data, data structure and area parameters. Same as

Simple example

Copy after login

Install

and use

npm install adc -addressmap

If used as a global component

//在项目入口文件 import Vue from 'vue' import Addressmap from 'adc-addressmap' Vue.component('Addressmap', Addressmap) 若作为局部组件 //在某个组件中 import Addressmap from 'adc-addressmap' export default { ... components: { Addressmap}, ... }
Copy after login
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

Implementing web front-end internationalization based on jQuery.i18n

##How to implement js using jQuery.i18n.properties International standards

The above is the detailed content of Detailed explanation of the steps to use the vue region selection component. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!