add select basic demo

pull/165/head
tjz 2018-02-24 19:53:21 +08:00
parent 709f5c65f4
commit 1d214aafe5
6 changed files with 51 additions and 8 deletions

View File

@ -70,3 +70,9 @@ const api = {
message,
}
export { api }
import Select from './select'
const SelectOption = Select.Option
const SelectOptGroup = Select.OptGroup
export { Select, SelectOption, SelectOptGroup }

View File

@ -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>
```

View File

@ -3,7 +3,7 @@ import PropTypes from '../_util/vue-types'
import VcSelect, { Option, OptGroup } from '../vc-select'
import LocaleReceiver from '../locale-provider/LocaleReceiver'
import defaultLocale from '../locale-provider/default'
import { getComponentFromProp } from '../_util/props-util'
import { getComponentFromProp, getOptionProps } from '../_util/props-util'
const AbstractSelectProps = {
prefixCls: PropTypes.string,
@ -101,7 +101,7 @@ export default {
size,
mode,
...restProps
} = this.$props
} = getOptionProps(this)
const cls = {
[`${prefixCls}-lg`]: size === 'large',
[`${prefixCls}-sm`]: size === 'small',

View File

@ -21,3 +21,4 @@ import './collapse/style'
import './notification/style'
import './message/style'
import './spin/style'
import './select/style'

View File

@ -195,7 +195,7 @@ export default {
},
updateLabelAndTitleMap (children = []) {
children.forEach(child => {
if (!child || (child.data && child.data.slot !== undefined)) {
if (!child.data || child.data.slot !== undefined) {
return
}
if (getSlotOptions(child).isSelectOptGroup) {
@ -472,7 +472,7 @@ export default {
values = [value]
}
children.forEach(child => {
if (!child || (child.data && child.data.slot !== undefined)) {
if (!child.data || child.data.slot !== undefined) {
return
}
if (getSlotOptions(child).isSelectOptGroup) {
@ -526,7 +526,7 @@ export default {
}
let label = null
children.forEach(child => {
if (!child || (child.data && child.data.slot !== undefined)) {
if (!child.data || child.data.slot !== undefined) {
return
}
if (getSlotOptions(child).isSelectOptGroup) {
@ -547,7 +547,7 @@ export default {
}
let value = null
children.forEach(child => {
if (!child || (child.data && child.data.slot !== undefined)) {
if (!child.data || child.data.slot !== undefined) {
return
}
if (getSlotOptions(child).isSelectOptGroup) {
@ -1159,7 +1159,7 @@ export default {
const { inputValue } = this
const tags = props.tags
children.forEach(child => {
if (!child || (child.data && child.data.slot !== undefined)) {
if (!child.data || child.data.slot !== undefined) {
return
}
if (getSlotOptions(child).isSelectOptGroup) {

View File

@ -3,7 +3,7 @@ const AsyncComp = () => {
const hashs = window.location.hash.split('/')
const d = hashs[hashs.length - 1]
return {
component: import(`../components/vc-select/demo/${d}.vue`),
component: import(`../components/select/demo/${d}.md`),
}
}
export default [