


vue select second level linkage second level selects the first option value by default
This article mainly shares with you an example of vue select second-level linkage selecting the first option value by default at the second level. It has a good reference value and I hope it will be helpful to everyone. Let’s follow the editor to take a look, I hope it can help everyone.
When the secondary linkage is, for example, selecting a country, and if you want to select a country, the subsequent city will select the first city by default, then just add a @change event to the country's select
<p class="inputLine"> <span>所在区域</span> <select name="" v-model="countryName" @change="selectCountry"> <option :value="item" v-for="(item,index) in area"> {{item.country}} <svg class="icon icon-arrow-bottom" aria-hidden="true"> <use xlink:href="#icon-arrow-bottom" rel="external nofollow" rel="external nofollow" ></use> </svg> </option> </select> <select name="" v-model="cityName"> <option :value="item" v-for="(item,index) in countryName.city"> {{item}} <svg class="icon icon-arrow-bottom" aria-hidden="true"> <use xlink:href="#icon-arrow-bottom" rel="external nofollow" rel="external nofollow" ></use> </svg> </option> </select> </p>
data countryName:{}, cityName:"请选择城市", area:[ { "country":"美国", "city":[ "纽约", "洛杉矶", "旧金山", "西雅图", "波士顿", "休斯顿", "圣地亚哥", "芝加哥", "其它", ] }, { "country":"加拿大", "city":[ "温哥华", "多伦多", "蒙特利尔", "其它" ] }, { "country":"澳大利亚", "city":[ "悉尼", "墨尔本", "其它" ] }, { "country":"新加坡", "city":[ "新加坡" ] }, /*{ "country":"中国", "city":[ "北京市", ] },*/ ],
methods:
selectCountry(value){ this.cityName=this.countryName.city[0]; },
Related recommendations:
js implements Select secondary linkage example sharing in HTML
How to implement select select secondary linkage effect
The simplest js code to implement select secondary linkage drop-down menu_javascript skills
The above is the detailed content of vue select second level linkage second level selects the first option value by default. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



In iOS 17.2, Apple lets you customize the sound your iPhone uses for default notifications. This is good news for anyone who doesn't like the "bounce" tone Apple is introducing in iOS 17. In previous iOS versions, Apple allowed users to choose ringtones and text tones, as well as custom alert sounds for email, calendar, and reminder alerts. Anything else that throws notifications uses the default sound, and there's no way to change it. In iOS17, Apple subsequently changed the original default alert sound from "Tri-tone" to "Rebound". Many users didn't like the change, and some thought the new sounds were harder to hear. Therefore, the default sound in iOS17.2 is changed to your

If your Bluetooth speakers or headphones on your Windows 11/10 computer are emitting a constant beeping sound, this may be ruining your music enjoyment. In this article, you will find ways to solve this problem so that you can eliminate this annoying situation. Bluetooth speakers or headphones keep beeping on Windows 11/10 If your Bluetooth headphones or speakers keep beeping on Windows 11/10, use the following suggestions to resolve the issue. Preliminary Steps Run the Audio Troubleshooter Update the firmware of your Bluetooth device Reinstall the required drivers Reset your Bluetooth device Your device may be faulty We have explained all these fixes in detail below. 1] Preliminary steps First, perform some preparatory steps. If these

Asynchronous processing method of SelectChannelsGo concurrent programming using golang Introduction: Concurrent programming is an important area in modern software development, which can effectively improve the performance and responsiveness of applications. In the Go language, concurrent programming can be implemented simply and efficiently using Channels and Select statements. This article will introduce how to use golang for asynchronous processing methods of SelectChannelsGo concurrent programming, and provide specific

How to hide the select element in jquery: 1. hide() method, introduce the jQuery library into the HTML page, you can use different selectors to hide the select element, the ID selector replaces the selectId with the ID of the select element you actually use; 2. css() method, use the ID selector to select the select element that needs to be hidden, use the css() method to set the display attribute to none, and replace selectId with the ID of the select element.

jQuery is a popular JavaScript library that can be used to simplify DOM manipulation, event handling, animation effects, etc. In web development, we often encounter situations where we need to change event binding on select elements. This article will introduce how to use jQuery to bind select element change events, and provide specific code examples. First, we need to create a dropdown menu with options using labels:

Youku software integrates a variety of different video resources for everyone to watch. Just search for what you want. And when downloading videos, friends can set the default download resolution of the video. If you want to know the specific operation method If so, remember to come to the PHP Chinese website to learn more. How to share the default download resolution of Youku 1. First open the Youku Video APP on your mobile phone and click [My] in the lower right corner of the page to switch. 2. After coming to my page, find the [Settings] function below and click on it to open it. 3. There is a [Default Download Resolution] on the settings page, click on it to enter the settings. 4. Finally, a list of options is displayed on the default download resolution page. Select the resolution you want to set.

Because select allows developers to wait for multiple file buffers at the same time, it can reduce IO waiting time and improve the IO efficiency of the process. The select() function is an IO multiplexing function that allows the program to monitor multiple file descriptors and wait for one or more of the monitored file descriptors to become "ready"; the so-called "ready" state is Refers to: the file descriptor is no longer blocked and can be used for certain types of IO operations, including readable, writable, and exceptions. select is a computer function located in the header file #include. This function is used to monitor file descriptor changes—reading, writing, or exceptions. 1. Introduction to the select function. The select function is an IO multiplexing function.

1. Keywords in SQL statements are not case-sensitive. SELECT is equivalent to SELECT, and FROM is equivalent to from. 2. To select all columns from the users table, you can use the symbol * to replace the column name. Syntax--this is a comment--query out [all] data from the [table] specified by FEOM. * means [all columns] SELECT*FROM--query out the specified data from the specified [table] from FROM Data of column name (field) SELECT column name FROM table name instance--Note: Use English commas to separate multiple columns selectusername, passwordfrom
