Просмотр исходного кода

feat: LazyCascader组件增changeOnSelect配置项兼容查询表格

lanjianrong 5 лет назад
Родитель
Сommit
63f890b05c

+ 2 - 2
src/components/LazyCascader/LazyCascader.jsx

@@ -3,7 +3,7 @@ import React, { forwardRef, useEffect } from 'react'
 import { connect } from 'dva'
 
 const CLazyCascader = props => {
-  const { refinstance, options, dispatch, onChange, ...resetProps } = props
+  const { refinstance, options, dispatch, onChange, changeOnSelect = false, ...resetProps } = props
   // console.log(props.defaultValue)
   useEffect(() => {
     if (!options.length) {
@@ -48,7 +48,7 @@ const CLazyCascader = props => {
       onChange={handleOnChange}
       loadData={loadData}
       fieldNames={{ label: 'name', value: 'id' }}
-      // changeOnSelect
+      changeOnSelect={changeOnSelect}
     />
   )
 }

+ 1 - 1
src/pages/Customer/Contact/index.jsx

@@ -510,7 +510,7 @@ const Contact = props => {
           onSearch: handleSearch
         },
         actions: [
-          <LazyCascader onChange={onDistrictChange} key="lazyCascader" />,
+          <LazyCascader onChange={onDistrictChange} changeOnSelect={true} key="lazyCascader" />,
           <Addcontact onConfirm={handleAddClient} key="addContactBtn" />
         ]
       }}