mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-01 13:36:55 +08:00
chore: add form supported on date-picker & select
This commit is contained in:
parent
ccd5a35eed
commit
47776fe117
@ -112,16 +112,20 @@
|
||||
import detachable from '../../../mixins/detachable'
|
||||
import placeable from '../../../mixins/placeable'
|
||||
import zindexable from '../../../mixins/zindexable'
|
||||
import withapp from '../../../mixins/withapp'
|
||||
import themeable from '../../../mixins/themeable'
|
||||
import asformitem from '../../../mixins/asformitem'
|
||||
import clickoutside from '../../../directives/clickoutside'
|
||||
|
||||
import DatetimePanel from './panel/datetime'
|
||||
import DatetimerangePanel from './panel/datetimerange'
|
||||
import DatePanel from './panel/date'
|
||||
import DaterangePanel from './panel/daterange'
|
||||
import clickoutside from '../../../directives/clickoutside'
|
||||
|
||||
import NInput from '../../Input'
|
||||
import NIcon from '../../Icon'
|
||||
import iosCalendar from '../../../icons/ios-calendar'
|
||||
import withapp from '../../../mixins/withapp'
|
||||
import themeable from '../../../mixins/themeable'
|
||||
|
||||
import format from 'date-fns/format'
|
||||
import getTime from 'date-fns/getTime'
|
||||
import isValid from 'date-fns/isValid'
|
||||
@ -172,7 +176,8 @@ export default {
|
||||
themeable,
|
||||
detachable,
|
||||
placeable,
|
||||
zindexable
|
||||
zindexable,
|
||||
asformitem()
|
||||
],
|
||||
props: {
|
||||
disabled: {
|
||||
|
@ -82,13 +82,13 @@ import detachable from '../../../mixins/detachable'
|
||||
import placeable from '../../../mixins/placeable'
|
||||
import toggleable from '../../../mixins/toggleable'
|
||||
import zindexable from '../../../mixins/zindexable'
|
||||
import Emitter from '../../../mixins/emitter'
|
||||
import clickoutside from '../../../directives/clickoutside'
|
||||
import NBaseSelectMenu from '../../../base/SelectMenu'
|
||||
import NBasePicker from '../../../base/Picker'
|
||||
import linkedOptions from '../../../utils/data/linkedOptions'
|
||||
import withapp from '../../../mixins/withapp'
|
||||
import themeable from '../../../mixins/themeable'
|
||||
import asformitem from '../../../mixins/asformitem'
|
||||
|
||||
export default {
|
||||
name: 'NBaseSelect',
|
||||
@ -99,7 +99,7 @@ export default {
|
||||
directives: {
|
||||
clickoutside
|
||||
},
|
||||
mixins: [withapp, themeable, detachable, toggleable, placeable, zindexable, Emitter],
|
||||
mixins: [withapp, themeable, detachable, toggleable, placeable, zindexable, asformitem()],
|
||||
inject: {
|
||||
NFormItem: {
|
||||
default: null
|
||||
@ -208,21 +208,13 @@ export default {
|
||||
filteredOptions () {
|
||||
this.$nextTick().then(() => {
|
||||
this.updatePosition()
|
||||
// if (this.$refs.scrollbar) {
|
||||
// this.$refs.scrollbar.updateParameters()
|
||||
// }
|
||||
})
|
||||
},
|
||||
value () {
|
||||
if (this.NFormItem) {
|
||||
this.dispatch('NFormItem', 'form-item-change', this.value)
|
||||
}
|
||||
value (value) {
|
||||
this.$nextTick().then(() => {
|
||||
this.updatePosition()
|
||||
// if (this.$refs.scrollbar) {
|
||||
// this.$refs.scrollbar.updateParameters()
|
||||
// }
|
||||
})
|
||||
this.emitChangeEvent(value)
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
@ -354,14 +346,12 @@ export default {
|
||||
this.pattern = ''
|
||||
}
|
||||
this.$emit('input', newValue)
|
||||
this.emitChangeEvent(newValue)
|
||||
} else {
|
||||
if (this.filterable && !this.multiple) {
|
||||
this.pattern = ''
|
||||
this.switchFocusToOuter()
|
||||
}
|
||||
this.$emit('input', option.value)
|
||||
this.emitChangeEvent(option.value)
|
||||
this.closeMenu()
|
||||
}
|
||||
},
|
||||
@ -386,7 +376,6 @@ export default {
|
||||
this.closeMenu()
|
||||
}
|
||||
this.$emit('input', null)
|
||||
this.emitChangeEvent(null)
|
||||
},
|
||||
/**
|
||||
* scroll events on menu
|
||||
|
@ -5,9 +5,9 @@
|
||||
@include once {
|
||||
@include b(date-picker) {
|
||||
position: relative;
|
||||
width: 200px;
|
||||
// width: 200px;
|
||||
@include m(range) {
|
||||
width: 382px;
|
||||
// width: 382px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user