diff --git a/public/react/src/modules/developer/components/knowledge/index.js b/public/react/src/modules/developer/components/knowledge/index.js index 491b9cb87..36060e8e8 100644 --- a/public/react/src/modules/developer/components/knowledge/index.js +++ b/public/react/src/modules/developer/components/knowledge/index.js @@ -4,10 +4,10 @@ * @Github: * @Date: 2019-12-30 13:51:19 * @LastEditors : tangjiang - * @LastEditTime : 2019-12-30 19:21:56 + * @LastEditTime : 2019-12-30 20:08:09 */ import './index.scss'; -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { Select } from 'antd'; const { Option } = Select; @@ -19,6 +19,10 @@ function KnowLedge (props) { values = [], // 已选择的下拉项 } = props; + useEffect(() => { + setSelectOptions(options || []); + }, [props]); + // 显示的下拉项 const [selectOptions, setSelectOptions] = useState(options); // 已选择的下拉项 @@ -30,7 +34,7 @@ function KnowLedge (props) { const renderOptions = (options = []) => { console.log('下拉选择: ', options); return options.map((opt, i) => ( - + )); } const handleSelectChange = (value) => { @@ -47,6 +51,7 @@ function KnowLedge (props) { // 渲染下拉列表 const renderSelect = (options, values) => { + console.log('==========>>>>>>>>', options); return (