|
|
|
@ -4,7 +4,7 @@
|
|
|
|
|
* @Github:
|
|
|
|
|
* @Date: 2019-12-30 13:51:19
|
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
|
* @LastEditTime : 2020-01-02 17:00:10
|
|
|
|
|
* @LastEditTime : 2020-01-03 09:32:24
|
|
|
|
|
*/
|
|
|
|
|
import './index.scss';
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
|
@ -21,13 +21,23 @@ function KnowLedge (props) {
|
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setSelectOptions(options || []);
|
|
|
|
|
const _options = [];
|
|
|
|
|
const _selects = [];
|
|
|
|
|
options.forEach(opt => {
|
|
|
|
|
if (!values.includes(opt.id)) {
|
|
|
|
|
_options.push(opt);
|
|
|
|
|
} else {
|
|
|
|
|
_selects.push(opt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
setSelectOptions(_options || []);
|
|
|
|
|
setSelectValue(_selects || []);
|
|
|
|
|
}, [props]);
|
|
|
|
|
|
|
|
|
|
// 显示的下拉项
|
|
|
|
|
const [selectOptions, setSelectOptions] = useState(options);
|
|
|
|
|
// 已选择的下拉项
|
|
|
|
|
const [selectValue, setSelectValue] = useState(values);
|
|
|
|
|
const [selectValue, setSelectValue] = useState([]);
|
|
|
|
|
//
|
|
|
|
|
const [value] = useState([]);
|
|
|
|
|
|
|
|
|
@ -87,8 +97,9 @@ function KnowLedge (props) {
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
// 渲染下拉列表
|
|
|
|
|
const renderSelect = (options) => {
|
|
|
|
|
const renderSelect = (options = []) => {
|
|
|
|
|
// console.log('+++++', options);
|
|
|
|
|
// setSelectValue(_selects);
|
|
|
|
|
return (
|
|
|
|
|
<Select
|
|
|
|
|
value={value}
|
|
|
|
|