Home  >  Article  >  Web Front-end  >  Open vue select operation component

Open vue select operation component

php中世界最好的语言
php中世界最好的语言Original
2018-06-08 17:26:122293browse

This time I will bring you the opening of the vue select operation component. What are the precautions for opening the vue select operation component? The following is a practical case, let's take a look.

Business: There are two ways to push messages, namely "WeChat" and "Mail". When sending via WeChat, you need to select "Application to be sent". When sending via email, you do not need to send via WeChat. When the email is sent, the page is as follows:

Open vue select operation component When the email is sent, the selector is not available, and the page is as follows:

邮件Open vue select operation componentAlthough the official website No specific example is given, but the "disabled" attribute can be found from the attributes,

Attributedisabled
Description Type Default value
Whether it is disabled Boolean false
Implementation:

Add the disabled attribute and write it in the following red mark format; define an isAble variable to store TRUE and FALSE values, Determines whether this selection box is available.

<select>v-bind:disabled="isAble" clearable v-model="dataAgentEntity.ID" style="width:240px"> 
   <option>{{ item.name }}</option> 
 </select> 
export default { 
  data(){ 
    return{ 
      isAble: false,//select下拉框是否可用 
    } 
  }

Then the value of the operating variable isAble in the logic changes the available and disabled status of the component.

 methods:{ 
     Test(){ 
      var vm = this; 
       if (vm.alertType == '邮件') { 
        vm.isAble = true; //不可用 
      } 
        
     }  
}

The test method only writes the judgment of being unavailable. When changing back to WeChat, it also needs to become Available status, otherwise another bug will be buried, haha. But this is business logic. I only introduce the method and take notes. It depends on the situation.

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:

JQuery makes merge/append array deduplication function


JS makes array traversal method summary And performance comparison

The above is the detailed content of Open vue select operation component. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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