当前位置:网站首页>012_ switch
012_ switch
2022-06-30 01:50:00 【Free and bound javajavascript】
1. Switch switch
1.1. Represents a switch between two opposing states , It's used to trigger 「 open / Turn off 」.
1.2. Switch properties
Parameters | explain | type | The default value is |
value / v-model | Binding value | boolean / string / number | nothing |
disabled | Whether to disable | boolean | false |
width | switch Width ( Pixels ) | number | 40 |
active-icon-class | switch The class name of the icon displayed when opened , Setting this option will ignore active-text | string | nothing |
inactive-icon-class | switch The class name of the icon displayed when closing , Setting this option will ignore inactive-text | string | nothing |
active-text | switch Text description when opening | string | nothing |
inactive-text | switch Text description when closing | string | nothing |
active-value | switch On the value of | boolean / string / number | true |
inactive-value | switch The value at the time of closing | boolean / string / number | false |
active-color | switch The background color when opened | string | #409EFF |
inactive-color | switch Background color when off | string | #C0CCDA |
name | switch Corresponding name attribute | string | nothing |
validate-event | change switch Whether to trigger the verification of the form in the status | boolean | true |
1.3. Switch events
Event name | explain | Callback Arguments |
change | switch Callback function when state changes | The value of the new state |
2. Switch Switch example
2.1. Use the scaffold to create a new one named element-ui-switch Front end projects , At the same time to install Element plug-in unit .

2.2. To write App.vue
<template>
<div id="app">
<h1> Basic usage </h1>
<el-switch v-model="base_value" active-color="#13ce66" inactive-color="#ff4949"></el-switch>
<h1> A word description </h1>
<el-switch v-model="text_value1" active-text=" Pay by month " inactive-text=" Pay per year " @change="handleChange"></el-switch>
<el-switch style="display: block" v-model="text_value2" active-color="#13ce66" inactive-color="#ff4949" active-text=" Pay by month " inactive-text=" Pay per year "></el-switch>
<h1> Extended value type </h1>
<el-tooltip :content="'Switch value: ' + ext_value" placement="top">
<el-switch v-model="ext_value" active-color="#13ce66" inactive-color="#ff4949" active-value="100" inactive-value="0"></el-switch>
</el-tooltip>
<h1> Disabled state </h1>
<el-switch v-model="disabled_value1" disabled></el-switch>
<el-switch v-model="disabled_value2" disabled></el-switch>
</div>
</template>
<script>
export default {
data () {
return {
base_value: true,
text_value1: true,
text_value2: true,
ext_value: '100',
disabled_value1: true,
disabled_value2: false
}
},
methods: {
handleChange (val) {
console.log(val)
}
}
}
</script>
2.3. Run the project

边栏推荐
- Who can use redis expired monitoring to close orders and get out of here!
- 假离婚变成真离婚,财产怎么办
- Pytorch 修改hook源码 获取Per-Layer输出参数(带layer name)
- [machine learning Q & A] cosine similarity, cosine distance, Euclidean distance and the meaning of distance in machine learning
- Sorting out the usage of transforms in pytoch
- Application features and functions of painting Aquarium
- MySQL monitoring 6
- Pytorch模型训练到哪里找预训练模型?
- What is idempotency? Detailed explanation of four interface idempotence schemes!
- 【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向
猜你喜欢

Understand AQS principle (flow chart and synchronous queue diagram)
![[graph neural network] overview of graph classification learning [2]: graph classification based on graph neural network](/img/5f/b23b64eed7f28ffd92c122b6859e2d.png)
[graph neural network] overview of graph classification learning [2]: graph classification based on graph neural network

Using grpcui to test asp Net core grpc service

js返回内容被unicode编码

画画水族馆的应用特色及功能

C语言 一元多项式求导
![[mrctf2020]ezpop-1 | PHP serialization](/img/65/9b7a3ae3552d8784b0c77a1130d762.png)
[mrctf2020]ezpop-1 | PHP serialization
![[pytorch actual combat] generate confrontation network Gan: generate cartoon character avatars](/img/8f/c0cc1c8d19060a60d92c0d72f8b93d.png)
[pytorch actual combat] generate confrontation network Gan: generate cartoon character avatars

AI落地制造业:智能机器人应具备这4种能力
![[graph neural network] summary of graph classification study [3]: evaluation of graph classification methods and future research directions](/img/b1/2afa73a14b2f41b7a65c4c2d261e6a.png)
[graph neural network] summary of graph classification study [3]: evaluation of graph classification methods and future research directions
随机推荐
Thinking carefully and fearfully: a software can be transmitted online to monitor whether employees want to "run away"
Tools and life services
Geotools wkt coordinate system conversion
Using grpcui to test asp Net core grpc service
Conversion between opencv and image (valid for pro test)
A summary of the quantification of deep network model
Cookie加密12
Mysql 监控6
210. Schedule II - depth traversal
[graph neural network] summary of graph classification study [3]: evaluation of graph classification methods and future research directions
手势数字启蒙学习机
cookie加密11
Cookie encryption 12
Cookie加密10
JS returned content is encoded by Unicode
Derivation of univariate polynomial in C language
Is it safe to open an account in Sinosteel futures?
Summary of DOM
What to remember about the penalty for deduction of points in Item 1
JS prototype and prototype chain (Lantern Festival meal)