当前位置:网站首页>007_ checkbox
007_ checkbox
2022-06-30 01:50:00 【Free and bound javajavascript】
1. Checkbox Checkbox
1.1. Make multiple choices from a set of alternatives .
1.2. Checkbox attribute
Parameters | explain | type | Optional value | The default value is |
value / v-model | Binding value | string / number / boolean | nothing | nothing |
label | The value of the selected state ( Only in checkbox-group Or the binding object type is array Effective when ) | string / number / boolean | nothing | nothing |
true-label | Selected value | string / number | nothing | nothing |
false-label | No selected value | string / number | nothing | nothing |
disabled | Whether to disable | boolean | nothing | false |
border | Show border or not | boolean | nothing | false |
size | Checkbox The size of the , Only in border It works when it's true | string | medium / small / mini | nothing |
name | Native name attribute | string | nothing | nothing |
checked | Whether to check | boolean | nothing | false |
indeterminate | Set up indeterminate state , Only responsible for style control | boolean | nothing | false |
1.3. Checkbox event
Event name | explain | Callback Arguments |
change | Event triggered when the binding value changes | Updated value |
1.4. Checkbox-group attribute
Parameters | explain | type | Optional value | The default value is |
value / v-model | Binding value | array | nothing | nothing |
size | Multiple selection box group size , Only for buttons Checkbox Or with a border Checkbox It works | string | medium / small / mini | nothing |
disabled | Whether to disable | boolean | nothing | false |
min | Can be checked checkbox Minimum number of | number | nothing | nothing |
max | Can be checked checkbox Maximum number of | number | nothing | nothing |
text-color | In the form of buttons Checkbox Text color when activated | string | nothing | #ffffff |
fill | In the form of buttons Checkbox Fill color and border color when active | string | nothing | #409EFF |
1.5. Checkbox-group event
Event name | explain | Callback Arguments |
change | Event triggered when the binding value changes | Updated value |
1.6. Checkbox-button attribute
Parameters | explain | type | Optional value | The default value is |
label | The value of the selected state ( Only in checkbox-group Or the binding object type is array Effective when ) | string / number / boolean | nothing | nothing |
true-label | Selected value | string / number | nothing | nothing |
false-label | No selected value | string / number | nothing | nothing |
disabled | Whether to disable | boolean | nothing | false |
name | Native name attribute | string | nothing | nothing |
checked | Whether to check | boolean | nothing | false |
2. Checkbox Multiple selection box example
2.1. Use the scaffold to create a new one named element-ui-checkbox 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-checkbox v-model="base_checkbox"> Options </el-checkbox>
<h1> Disabled state </h1>
<el-checkbox v-model="disabled_checkbox1" disabled> Options 1</el-checkbox>
<el-checkbox v-model="disabled_checkbox2" disabled> Options 2</el-checkbox>
<h1> Multi box group </h1>
<el-checkbox-group v-model="group_checkbox">
<el-checkbox label=" Check box A"></el-checkbox>
<el-checkbox label=" Check box B"></el-checkbox>
<el-checkbox label=" Check box C"></el-checkbox>
<el-checkbox label=" Ban " disabled></el-checkbox>
<el-checkbox label=" Check and disable " disabled></el-checkbox>
</el-checkbox-group>
<h1>indeterminate state </h1>
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"> Future generations </el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="checkedCities" @change="handleCheckedCitiesChange">
<el-checkbox v-for="city in cities" :label="city" :key="city">{
{city}}</el-checkbox>
</el-checkbox-group>
<h1> Limitation on the number of optional items </h1>
<el-checkbox-group v-model="selectable_checkedCities" :min="1" :max="2">
<el-checkbox v-for="city in selectable_cities" :label="city" :key="city">{
{city}}</el-checkbox>
</el-checkbox-group>
<h1> Button style </h1>
<div>
<el-checkbox-group v-model="button_checkbox_group1">
<el-checkbox-button v-for="city in cities" :label="city" :key="city">{
{city}}</el-checkbox-button>
</el-checkbox-group>
</div>
<div style="margin-top: 20px">
<el-checkbox-group v-model="button_checkbox_group2" size="medium">
<el-checkbox-button v-for="city in cities" :label="city" :key="city">{
{city}}</el-checkbox-button>
</el-checkbox-group>
</div>
<div style="margin-top: 20px">
<el-checkbox-group v-model="button_checkbox_group3" size="small">
<el-checkbox-button v-for="city in cities" :label="city" :disabled="city === ' Beijing '" :key="city">{
{city}}</el-checkbox-button>
</el-checkbox-group>
</div>
<div style="margin-top: 20px">
<el-checkbox-group v-model="button_checkbox_group4" size="mini" disabled>
<el-checkbox-button v-for="city in cities" :label="city" :key="city">{
{city}}</el-checkbox-button>
</el-checkbox-group>
</div>
<h1> With borders </h1>
<el-checkbox v-model="border_checked1" border> Options 1</el-checkbox>
<el-checkbox v-model="border_checked2" border> Options 2</el-checkbox>
</div>
</template>
<script>
const cityOptions = [' Shanghai ', ' Beijing ', ' Guangzhou ', ' Shenzhen ']
export default {
data () {
return {
base_checkbox: true,
disabled_checkbox1: false,
disabled_checkbox2: true,
group_checkbox: [' Check and disable ', ' Check box A'],
checkAll: false,
checkedCities: [' Shanghai ', ' Beijing '],
cities: cityOptions,
isIndeterminate: true,
selectable_checkedCities: [' Shanghai ', ' Beijing '],
selectable_cities: cityOptions,
button_checkbox_group1: [' Shanghai '],
button_checkbox_group2: [' Beijing '],
button_checkbox_group3: [' Guangzhou '],
button_checkbox_group4: [' Shenzhen '],
border_checked1: true,
border_checked2: false
}
},
methods: {
handleCheckAllChange (val) {
this.checkedCities = val ? cityOptions : []
this.checkAll = this.checkedCities.length === this.cities.length
this.isIndeterminate = false
},
handleCheckedCitiesChange (value) {
const checkedCount = value.length
this.checkAll = checkedCount === this.cities.length
this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length
}
}
}
</script>
2.3. Run the project

边栏推荐
- Cookie加密10
- Unity2D--给动画添加关键帧并绑定事件
- Is the processor the main factor in buying a mobile phone?
- Cookie encryption 8
- JS reverse request parameter encryption:
- Local page floating animation is realized with the help of scroll wheel
- Fake divorce turns into real divorce. What about property
- Geotools: common tools for mutual conversion of wkt, geojason, feature and featurecollection
- [graph neural network] overview of graph classification learning [2]: graph classification based on graph neural network
- 什么是幂等性?四种接口幂等性方案详解!
猜你喜欢
![[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
![[mrctf2020]ezpop-1 | PHP serialization](/img/65/9b7a3ae3552d8784b0c77a1130d762.png)
[mrctf2020]ezpop-1 | PHP serialization

C语言 成绩排名

JS returned content is encoded by Unicode

Cookie encryption 13

cookie加密8

AI落地制造业:智能机器人应具备这4种能力

Design and implementation of spark offline development framework

The first technology podcast month will begin soon

What is idempotency? Detailed explanation of four interface idempotence schemes!
随机推荐
Fake divorce turns into real divorce. What about property
Mysql 监控
Cookie encryption 9
(4) Blender source code analysis flash window display process
画画水族馆的应用特色及功能
Unity2D--给动画添加关键帧并绑定事件
[machine learning Q & A] accuracy, accuracy, recall, ROC and AUC
Varnish 基础概览1
C language number prime
【图神经网络】图分类学习研究综述[3]:图分类方法评价及未来研究方向
模块导入reload方法
js Array. Five convenient applications of from()
工具与生活服务
对深度网络模型量化工作的总结
Varnish foundation overview 10
TP-LINK configure WiFi authentication method for wireless Internet SMS
C语言 素数对猜想
C language I want to pass
Module import reload method
Derivation of univariate polynomial in C language