From 71d4765ba3cdc4a004687cd37a529b565e9ea9fd Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 06 七月 2021 16:26:29 +0800 Subject: [PATCH] 2021-07-06 --- src/mob/components/topbar/normal-navbar/index.jsx | 28 ++++++++++++++++++++++++++-- 1 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index 6f0a585..ca764ec 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -59,6 +59,7 @@ componentDidMount () { MKEmitter.addListener('submitStyle', this.getStyle) + MKEmitter.addListener('submitSearch', this.getSearch) } shouldComponentUpdate (nextProps, nextState) { @@ -73,6 +74,7 @@ return } MKEmitter.removeListener('submitStyle', this.getStyle) + MKEmitter.removeListener('submitSearch', this.getSearch) } /** @@ -130,8 +132,31 @@ } } - setSearch = () => { + getSearch = (config) => { + const { card } = this.state + if (card.uuid !== config.uuid) return + + this.setState({ + card: config + }) + + this.props.updateConfig(config) + } + + setSearch = () => { + let card = fromJS(this.state.card).toJS() + + if (!card.search) { + card.search = { + floor: 1, + setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' }, + groups: [], + fields: [] + } + } + this.props.updateConfig(card) + MKEmitter.emit('changeSearch', card) } render() { @@ -141,7 +166,6 @@ if (_style.shadow) { _style.boxShadow = '0 0 4px ' + _style.shadow } - _style.height = card.wrap.height return ( <div className="normal-topbar-edit-box" style={_style} onClick={this.clickComponent} id={card.uuid}> -- Gitblit v1.8.0