2021-12-30 00:44:43 +08:00
|
|
|
::: anchor
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 基础使用
|
2021-10-24 21:31:42 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-12 16:22:26 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-form>
|
2021-11-18 00:45:22 +08:00
|
|
|
<lay-checkbox name="like" skin="primary" v-model="checked1" label="1" ></lay-checkbox>
|
2021-10-12 16:22:26 +08:00
|
|
|
</lay-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-13 21:43:23 +08:00
|
|
|
const checked1 = ref(false)
|
|
|
|
|
2021-10-12 16:22:26 +08:00
|
|
|
return {
|
2021-10-13 21:43:23 +08:00
|
|
|
checked1
|
2021-10-12 16:22:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 默认样式
|
2021-10-24 21:31:42 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-13 10:04:43 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-form>
|
2021-11-18 00:45:22 +08:00
|
|
|
<lay-checkbox name="like" label="1" v-model="checked2" >普通</lay-checkbox>
|
2021-10-13 10:04:43 +08:00
|
|
|
</lay-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-13 21:43:23 +08:00
|
|
|
const checked2 = ref(false)
|
|
|
|
|
2021-10-13 10:04:43 +08:00
|
|
|
return {
|
2021-10-13 21:43:23 +08:00
|
|
|
checked2
|
2021-10-13 10:04:43 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-11-19 00:42:26 +08:00
|
|
|
::: title 复选框组
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-form>
|
|
|
|
<lay-checkbox-group v-model="checkeds" @change="groupChange">
|
|
|
|
<lay-checkbox name="like" skin="primary" label="1">写作</lay-checkbox>
|
|
|
|
<lay-checkbox name="like" skin="primary" label="2">画画</lay-checkbox>
|
|
|
|
<lay-checkbox name="like" skin="primary" label="3">运动</lay-checkbox>
|
|
|
|
</lay-checkbox-group>
|
|
|
|
</lay-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
|
|
|
const checkeds = ref(['1','2']);
|
|
|
|
const groupChange = function(val) {
|
|
|
|
console.log("回调:" + JSON.stringify(val))
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
checkeds,
|
|
|
|
groupChange
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 完整案例
|
2021-10-24 21:31:42 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-12 16:22:26 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-form>
|
2021-11-18 00:45:22 +08:00
|
|
|
<lay-checkbox name="like" skin="primary" v-model="checked3" label="1">写作</lay-checkbox>
|
|
|
|
<lay-checkbox name="like" skin="primary" v-model="checked4" label="2">画画</lay-checkbox>
|
|
|
|
<lay-checkbox name="like" skin="primary" v-model="checked5" label="3">运动</lay-checkbox>
|
2021-10-12 16:22:26 +08:00
|
|
|
</lay-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
|
|
|
const checked3 = ref(true);
|
2021-10-13 21:43:23 +08:00
|
|
|
const checked4 = ref(true);
|
|
|
|
const checked5 = ref(true);
|
|
|
|
|
2021-10-12 16:22:26 +08:00
|
|
|
return {
|
2021-10-13 21:43:23 +08:00
|
|
|
checked3, checked4, checked5
|
2021-10-12 16:22:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 禁用状态
|
2021-10-24 21:31:42 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-12 23:52:46 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-form>
|
2021-11-18 00:45:22 +08:00
|
|
|
<lay-checkbox name="like" skin="primary" label="1" :disabled="disabled" v-model="checked6">禁用</lay-checkbox>
|
2021-10-12 23:52:46 +08:00
|
|
|
</lay-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-13 11:23:25 +08:00
|
|
|
const disabled = ref(true)
|
2021-10-12 23:52:46 +08:00
|
|
|
|
2021-10-18 21:31:06 +08:00
|
|
|
const checked6 = ref(false);
|
2021-10-13 21:43:23 +08:00
|
|
|
|
2021-10-12 23:52:46 +08:00
|
|
|
return {
|
2021-10-13 21:43:23 +08:00
|
|
|
disabled,checked6
|
2021-10-12 23:52:46 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2021-10-12 16:22:26 +08:00
|
|
|
|
2021-10-12 23:52:46 +08:00
|
|
|
:::
|
2021-10-12 16:22:26 +08:00
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 事件回调
|
2021-10-24 21:31:42 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-12 16:22:26 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-form>
|
2021-11-18 00:45:22 +08:00
|
|
|
<lay-checkbox name="like" skin="primary" label="1" @change="change" v-model="checked7">回调</lay-checkbox>
|
2021-10-12 16:22:26 +08:00
|
|
|
</lay-form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-13 21:43:23 +08:00
|
|
|
const checked7 = ref(true);
|
|
|
|
|
2021-10-12 16:22:26 +08:00
|
|
|
const change = function(isChecked) {
|
|
|
|
console.log("是否选中:" + isChecked)
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
2021-10-13 21:43:23 +08:00
|
|
|
change,
|
|
|
|
checked7
|
2021-10-12 16:22:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-01-10 01:17:03 +08:00
|
|
|
::: title Checkbox 属性
|
2021-10-24 21:31:42 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 属性 | 描述 | 可选值 |
|
2021-10-14 16:39:06 +08:00
|
|
|
| ------------------- | ------------- | -------------------- |
|
|
|
|
| name | 原始属性 name | -- |
|
|
|
|
| skin | 主题 | -- |
|
|
|
|
| label | 选中值 | -- |
|
2021-11-18 00:45:22 +08:00
|
|
|
| v-model | 是否选中 | `true` `false` |
|
2021-10-14 16:39:06 +08:00
|
|
|
| change | 切换事件 | isChecked : 当前状态 |
|
2021-11-01 01:02:21 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
:::
|
|
|
|
|
2022-01-10 01:17:03 +08:00
|
|
|
::: title Checkbox 事件
|
2021-11-01 01:02:21 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-11-01 01:02:21 +08:00
|
|
|
| 事件 | 描述 | 可选值 |
|
|
|
|
| ------ | -------- | -------------------- |
|
|
|
|
| change | 切换事件 | isChecked : 当前状态 |
|
2021-11-07 15:55:08 +08:00
|
|
|
|
|
|
|
:::
|
2021-12-16 17:57:59 +08:00
|
|
|
|
|
|
|
::: comment
|
2022-01-12 14:19:06 +08:00
|
|
|
:::
|
|
|
|
|
|
|
|
::: previousNext checkbox
|
2021-12-16 17:57:59 +08:00
|
|
|
:::
|