add select basic demo
parent
709f5c65f4
commit
1d214aafe5
|
@ -70,3 +70,9 @@ const api = {
|
||||||
message,
|
message,
|
||||||
}
|
}
|
||||||
export { api }
|
export { api }
|
||||||
|
|
||||||
|
import Select from './select'
|
||||||
|
const SelectOption = Select.Option
|
||||||
|
const SelectOptGroup = Select.OptGroup
|
||||||
|
export { Select, SelectOption, SelectOptGroup }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
|
||||||
|
<cn>
|
||||||
|
#### 基本使用
|
||||||
|
基本使用。
|
||||||
|
</cn>
|
||||||
|
|
||||||
|
<us>
|
||||||
|
#### Basic Usage
|
||||||
|
Basic Usage
|
||||||
|
</us>
|
||||||
|
|
||||||
|
```html
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<a-select defaultValue="lucy" style='width: 120px' @change='handleChange'>
|
||||||
|
<a-select-option value="jack">Jack</a-select-option>
|
||||||
|
<a-select-option value="lucy">Lucy</a-select-option>
|
||||||
|
<a-select-option value="disabled" disabled>Disabled</a-select-option>
|
||||||
|
<a-select-option value="Yiminghe">yiminghe</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
<a-select defaultValue="lucy" style='width: 120px' allowClear disabled>
|
||||||
|
<a-select-option value="lucy">Lucy</a-select-option>
|
||||||
|
</a-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
methods: {
|
||||||
|
handleChange(value) {
|
||||||
|
console.log(`selected ${value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
```
|
||||||
|
|
|
@ -3,7 +3,7 @@ import PropTypes from '../_util/vue-types'
|
||||||
import VcSelect, { Option, OptGroup } from '../vc-select'
|
import VcSelect, { Option, OptGroup } from '../vc-select'
|
||||||
import LocaleReceiver from '../locale-provider/LocaleReceiver'
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'
|
||||||
import defaultLocale from '../locale-provider/default'
|
import defaultLocale from '../locale-provider/default'
|
||||||
import { getComponentFromProp } from '../_util/props-util'
|
import { getComponentFromProp, getOptionProps } from '../_util/props-util'
|
||||||
|
|
||||||
const AbstractSelectProps = {
|
const AbstractSelectProps = {
|
||||||
prefixCls: PropTypes.string,
|
prefixCls: PropTypes.string,
|
||||||
|
@ -101,7 +101,7 @@ export default {
|
||||||
size,
|
size,
|
||||||
mode,
|
mode,
|
||||||
...restProps
|
...restProps
|
||||||
} = this.$props
|
} = getOptionProps(this)
|
||||||
const cls = {
|
const cls = {
|
||||||
[`${prefixCls}-lg`]: size === 'large',
|
[`${prefixCls}-lg`]: size === 'large',
|
||||||
[`${prefixCls}-sm`]: size === 'small',
|
[`${prefixCls}-sm`]: size === 'small',
|
||||||
|
|
|
@ -21,3 +21,4 @@ import './collapse/style'
|
||||||
import './notification/style'
|
import './notification/style'
|
||||||
import './message/style'
|
import './message/style'
|
||||||
import './spin/style'
|
import './spin/style'
|
||||||
|
import './select/style'
|
||||||
|
|
|
@ -195,7 +195,7 @@ export default {
|
||||||
},
|
},
|
||||||
updateLabelAndTitleMap (children = []) {
|
updateLabelAndTitleMap (children = []) {
|
||||||
children.forEach(child => {
|
children.forEach(child => {
|
||||||
if (!child || (child.data && child.data.slot !== undefined)) {
|
if (!child.data || child.data.slot !== undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (getSlotOptions(child).isSelectOptGroup) {
|
if (getSlotOptions(child).isSelectOptGroup) {
|
||||||
|
@ -472,7 +472,7 @@ export default {
|
||||||
values = [value]
|
values = [value]
|
||||||
}
|
}
|
||||||
children.forEach(child => {
|
children.forEach(child => {
|
||||||
if (!child || (child.data && child.data.slot !== undefined)) {
|
if (!child.data || child.data.slot !== undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (getSlotOptions(child).isSelectOptGroup) {
|
if (getSlotOptions(child).isSelectOptGroup) {
|
||||||
|
@ -526,7 +526,7 @@ export default {
|
||||||
}
|
}
|
||||||
let label = null
|
let label = null
|
||||||
children.forEach(child => {
|
children.forEach(child => {
|
||||||
if (!child || (child.data && child.data.slot !== undefined)) {
|
if (!child.data || child.data.slot !== undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (getSlotOptions(child).isSelectOptGroup) {
|
if (getSlotOptions(child).isSelectOptGroup) {
|
||||||
|
@ -547,7 +547,7 @@ export default {
|
||||||
}
|
}
|
||||||
let value = null
|
let value = null
|
||||||
children.forEach(child => {
|
children.forEach(child => {
|
||||||
if (!child || (child.data && child.data.slot !== undefined)) {
|
if (!child.data || child.data.slot !== undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (getSlotOptions(child).isSelectOptGroup) {
|
if (getSlotOptions(child).isSelectOptGroup) {
|
||||||
|
@ -1159,7 +1159,7 @@ export default {
|
||||||
const { inputValue } = this
|
const { inputValue } = this
|
||||||
const tags = props.tags
|
const tags = props.tags
|
||||||
children.forEach(child => {
|
children.forEach(child => {
|
||||||
if (!child || (child.data && child.data.slot !== undefined)) {
|
if (!child.data || child.data.slot !== undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (getSlotOptions(child).isSelectOptGroup) {
|
if (getSlotOptions(child).isSelectOptGroup) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ const AsyncComp = () => {
|
||||||
const hashs = window.location.hash.split('/')
|
const hashs = window.location.hash.split('/')
|
||||||
const d = hashs[hashs.length - 1]
|
const d = hashs[hashs.length - 1]
|
||||||
return {
|
return {
|
||||||
component: import(`../components/vc-select/demo/${d}.vue`),
|
component: import(`../components/select/demo/${d}.md`),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default [
|
export default [
|
||||||
|
|
Loading…
Reference in New Issue