From 876a5e6657d67df66bb525d02dd6d147ba81cae5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 05 一月 2023 09:53:37 +0800 Subject: [PATCH] 2023-01-05 --- src/tabviews/zshare/actionList/index.jsx | 33 ++++++++++++++++++++++++++++++--- 1 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/tabviews/zshare/actionList/index.jsx b/src/tabviews/zshare/actionList/index.jsx index 7dd0d4b..911e141 100644 --- a/src/tabviews/zshare/actionList/index.jsx +++ b/src/tabviews/zshare/actionList/index.jsx @@ -1,7 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Affix } from 'antd' +import { Affix, Dropdown } from 'antd' +import { DownOutlined } from '@ant-design/icons' import asyncComponent from './asyncButtonComponent' import './index.scss' @@ -29,7 +30,25 @@ setting: PropTypes.any, // 椤甸潰閫氱敤璁剧疆 } - state = {} + state = { + actions: [], + mores: null + } + + UNSAFE_componentWillMount() { + const { setting, actions } = this.props + + if (!setting.btnlimit || setting.btnlimit >= actions.length) { + this.setState({actions: actions}) + } else { + let mores = fromJS(actions).toJS() + + this.setState({ + actions: mores.splice(0, setting.btnlimit), + mores + }) + } + } shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) @@ -139,6 +158,7 @@ btn={item} BData={BData} setting={setting} + columns={columns} selectedData={selectedData} /> ) @@ -173,7 +193,8 @@ } render() { - const { setting, MenuID, actions } = this.props + const { setting, MenuID } = this.props + const { actions, mores } = this.state let fixed = setting.actionfixed && setting.tabType === 'main' // 鎸夐挳鏄惁鍥哄畾鍦ㄥご閮� if (fixed && MenuID) { @@ -181,6 +202,9 @@ <Affix offsetTop={48}> <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}> {this.getButtonList(actions)} + {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}> + <div className="mk-more">鏇村<DownOutlined/></div> + </Dropdown> : null} </div> </Affix> ) @@ -188,6 +212,9 @@ return ( <div className="button-list toolbar-button" id={fixed ? MenuID + 'mainaction' : ''}> {this.getButtonList(actions)} + {mores ? <Dropdown overlay={<div className="mk-button-dropdown-wrap">{this.getButtonList(mores)}</div>} trigger={['hover']}> + <div className="mk-more">鏇村<DownOutlined/></div> + </Dropdown> : null} </div> ) } -- Gitblit v1.8.0