This time I will bring you a detailed explanation of how to enable and disable the vue select component. What are the precautions for opening and disabling the vue select 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", No need to select ## when sending by email
#When sending by WeChat, the page is as follows: When sending by email, the selector is not available, and the page is as follows:Although no specific example is given on the official website, the "disabled" attribute can be found from the attributes,
Description | Type | Default value | |
---|---|---|---|
Whether it is disabled | Boolean | false |
Add the disabled attribute and write it in the following red mark format; define an isAble variable for Stores TRUE and FALSE values to determine 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:
How to remove duplicate data when merging multiple arraysWhat is needed to determine the type and size of uploaded images stepThe above is the detailed content of Detailed explanation of how to enable and disable the vue select component. For more information, please follow other related articles on the PHP Chinese website!