fix
parent
551c5e718d
commit
d5686f2624
|
@ -1,8 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import PropTypes from '../_util/vue-types'
|
import PropTypes from '../_util/vue-types'
|
||||||
import align from 'dom-align'
|
import align from 'dom-align'
|
||||||
import clonedeep from 'lodash.clonedeep'
|
|
||||||
import isEqual from 'lodash.isequal'
|
|
||||||
import addEventListener from '../_util/Dom/addEventListener'
|
import addEventListener from '../_util/Dom/addEventListener'
|
||||||
import { cloneElement } from '../_util/vnode.js'
|
import { cloneElement } from '../_util/vnode.js'
|
||||||
import isWindow from './isWindow'
|
import isWindow from './isWindow'
|
||||||
|
@ -44,6 +42,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
this.prevProps = { ...this.$props }
|
||||||
const props = this.$props
|
const props = this.$props
|
||||||
// if parent ref not attached .... use document.getElementById
|
// if parent ref not attached .... use document.getElementById
|
||||||
!this.aligned && this.forceAlign()
|
!this.aligned && this.forceAlign()
|
||||||
|
@ -56,7 +55,7 @@ export default {
|
||||||
const props = this.$props
|
const props = this.$props
|
||||||
let reAlign = false
|
let reAlign = false
|
||||||
if (!props.disabled) {
|
if (!props.disabled) {
|
||||||
if (prevProps.disabled || !isEqual(prevProps.align, props.align)) {
|
if (prevProps.disabled || prevProps.align !== props.align) {
|
||||||
reAlign = true
|
reAlign = true
|
||||||
} else {
|
} else {
|
||||||
const lastTarget = prevProps.target()
|
const lastTarget = prevProps.target()
|
||||||
|
@ -78,6 +77,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.stopMonitorWindowResize()
|
this.stopMonitorWindowResize()
|
||||||
}
|
}
|
||||||
|
this.prevProps = { ...this.$props }
|
||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.stopMonitorWindowResize()
|
this.stopMonitorWindowResize()
|
||||||
|
@ -109,7 +109,6 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
this.prevProps = clonedeep(this.$props)
|
|
||||||
const { childrenProps } = this.$props
|
const { childrenProps } = this.$props
|
||||||
const child = this.$slots.default[0]
|
const child = this.$slots.default[0]
|
||||||
if (childrenProps) {
|
if (childrenProps) {
|
||||||
|
|
|
@ -51,6 +51,9 @@ export default {
|
||||||
prop: 'selectedKeys',
|
prop: 'selectedKeys',
|
||||||
event: 'selectChange',
|
event: 'selectChange',
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.preProps = { ...this.props }
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$props': {
|
'$props': {
|
||||||
handler: function (nextProps) {
|
handler: function (nextProps) {
|
||||||
|
@ -74,8 +77,9 @@ export default {
|
||||||
this.setState({ sOpenKeys: this.inlineOpenKeys })
|
this.setState({ sOpenKeys: this.inlineOpenKeys })
|
||||||
this.inlineOpenKeys = []
|
this.inlineOpenKeys = []
|
||||||
}
|
}
|
||||||
|
this.preProps = { ...nextProps }
|
||||||
},
|
},
|
||||||
deep: true,
|
// deep: true,
|
||||||
},
|
},
|
||||||
'layoutContext.siderCollapsed': function (val) {
|
'layoutContext.siderCollapsed': function (val) {
|
||||||
const { openKeys, sOpenKeys, prefixCls } = this
|
const { openKeys, sOpenKeys, prefixCls } = this
|
||||||
|
@ -196,9 +200,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
render () {
|
render () {
|
||||||
const { $props, layoutContext, $slots, $listeners } = this
|
const { layoutContext, $slots, $listeners } = this
|
||||||
const { collapsedWidth, siderCollapsed } = layoutContext
|
const { collapsedWidth, siderCollapsed } = layoutContext
|
||||||
this.preProps = cloneDeep($props)
|
|
||||||
this.preLayoutContext = {
|
this.preLayoutContext = {
|
||||||
siderCollapsed,
|
siderCollapsed,
|
||||||
collapsedWidth,
|
collapsedWidth,
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<script>
|
||||||
|
import Select, { Option } from '../index'
|
||||||
|
import '../assets/index.less'
|
||||||
|
import { fetch } from './tbFetchSuggest'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
data: [],
|
||||||
|
value: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onChange (value) {
|
||||||
|
console.log('onChange ', value)
|
||||||
|
this.value = value
|
||||||
|
},
|
||||||
|
fetchData (value) {
|
||||||
|
fetch(value, (data) => {
|
||||||
|
this.data = data
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const data = this.data
|
||||||
|
const options = data.map((d) => {
|
||||||
|
return <Option key={d.value}><i>{d.text}</i></Option>
|
||||||
|
})
|
||||||
|
return (<div>
|
||||||
|
<h2>multiple suggest</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<Select
|
||||||
|
value={this.value}
|
||||||
|
labelInValue
|
||||||
|
style={{ width: '500px' }}
|
||||||
|
animation='slide-up'
|
||||||
|
placeholder='搜索下'
|
||||||
|
optionLabelProp='children'
|
||||||
|
multiple
|
||||||
|
notFoundContent=''
|
||||||
|
onSearch={this.fetchData}
|
||||||
|
onChange={this.onChange}
|
||||||
|
filterOption={false}
|
||||||
|
>
|
||||||
|
{options}
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in New Issue