2021-10-26 01:13:23 +08:00
|
|
|
::: title 基础使用
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-20 14:42:04 +08:00
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
2021-12-20 23:02:13 +08:00
|
|
|
<lay-select v-model="value">
|
2021-10-20 21:48:05 +08:00
|
|
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
|
|
|
<lay-select-option value="2" label="编码"></lay-select-option>
|
|
|
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
|
|
|
</lay-select>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
2021-12-20 23:02:13 +08:00
|
|
|
const value = ref(null);
|
2021-10-20 21:48:05 +08:00
|
|
|
return {
|
2021-12-20 23:02:13 +08:00
|
|
|
value
|
2021-10-20 21:48:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title 选择禁用
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-select v-model="selected">
|
|
|
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
2021-12-20 23:02:13 +08:00
|
|
|
<lay-select-option value="2" label="编码" disabled></lay-select-option>
|
2021-10-20 21:48:05 +08:00
|
|
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
2021-10-20 14:42:04 +08:00
|
|
|
</lay-select>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
|
2021-10-20 21:48:05 +08:00
|
|
|
const selected = ref('1')
|
|
|
|
|
2021-10-20 14:42:04 +08:00
|
|
|
return {
|
2021-10-20 21:48:05 +08:00
|
|
|
selected
|
2021-10-20 14:42:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
2021-12-20 23:02:13 +08:00
|
|
|
::: title 多选使用
|
|
|
|
:::
|
|
|
|
|
|
|
|
::: demo
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<lay-select v-model="mvalue" @change="change" multiple>
|
|
|
|
<lay-select-option value="1" label="学习"></lay-select-option>
|
|
|
|
<lay-select-option value="2" label="编码" disabled></lay-select-option>
|
|
|
|
<lay-select-option value="3" label="运动"></lay-select-option>
|
|
|
|
<lay-select-option value="4" label="唱歌"></lay-select-option>
|
|
|
|
<lay-select-option value="5" label="跳舞"></lay-select-option>
|
|
|
|
<lay-select-option value="6" label="打篮球"></lay-select-option>
|
|
|
|
<lay-select-option value="7" label="rap"></lay-select-option>
|
|
|
|
</lay-select>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { ref,watch } from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
setup() {
|
|
|
|
const mvalue = ref(['1','2']);
|
|
|
|
const change = function(val){
|
|
|
|
console.log(val, mvalue.value)
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
mvalue,
|
|
|
|
change
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title select 属性
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-12-20 23:02:13 +08:00
|
|
|
| 属性 | 描述 | 类型 | 可选值 | 默认值 |
|
|
|
|
| ------------ | --------------------- | ------------------------- | -------------- | -------- |
|
|
|
|
| v-model | 选中值 | `string`/`number`/`Array` | - | - |
|
|
|
|
| name | 原生 name 属性 | `string` | - | - |
|
|
|
|
| placeholder | 默认空提示语 | `string` | - | `请选择` |
|
|
|
|
| disabled | 是否禁用 | `boolean` | `true` `false` | `false` |
|
|
|
|
| showEmpty | 是否增加空提示选项 | `boolean` | `true` `false` | `true` |
|
|
|
|
| multiple | 是否为多选 | `boolean` | `true` `false` | `false` |
|
|
|
|
|
2021-10-20 21:48:05 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title select-option 属性
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-12-20 23:02:13 +08:00
|
|
|
|
|
|
|
::: table
|
|
|
|
|
|
|
|
| 属性 | 描述 | 类型 | 可选值 | 默认值 |
|
|
|
|
| ------------ | --------------------- | ------------------------- | -------------- | -------- |
|
|
|
|
| label | 标签值(`必填`) | `string` | - | - |
|
|
|
|
| value | 值 | `string` / `number` | - | - |
|
|
|
|
| disabled | 是否禁用 | `boolean` | `true` `false` | `false` |
|
2021-10-20 21:48:05 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title select-option 插槽
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-12-20 23:02:13 +08:00
|
|
|
| 属性 | 描述 | 接收值 |
|
|
|
|
| ------- | ----------------- | --------------- |
|
|
|
|
| default | 默认(`label`) | - |
|
2021-10-20 21:48:05 +08:00
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
:::
|
|
|
|
|
2021-10-26 01:13:23 +08:00
|
|
|
::: title select 事件
|
2021-10-20 21:48:05 +08:00
|
|
|
:::
|
|
|
|
|
2021-11-07 15:55:08 +08:00
|
|
|
::: table
|
|
|
|
|
2021-12-20 23:02:13 +08:00
|
|
|
| 属性 | 描述 | 接收值 |
|
|
|
|
| ------ | ---------- | --------------- |
|
2021-10-26 01:14:17 +08:00
|
|
|
| change | 切换事件 | value |
|
2021-11-07 15:55:08 +08:00
|
|
|
|
2021-11-07 15:56:24 +08:00
|
|
|
:::
|
2021-12-16 17:57:59 +08:00
|
|
|
|
|
|
|
::: comment
|
|
|
|
:::
|