update 0.15.1
This commit is contained in:
		| @@ -2,7 +2,7 @@ | ||||
|  * @Author: yehuozhili | ||||
|  * @Date: 2021-09-28 21:10:15 | ||||
|  * @LastEditors: yehuozhili | ||||
|  * @LastEditTime: 2022-01-13 15:42:56 | ||||
|  * @LastEditTime: 2022-04-27 22:36:07 | ||||
|  * @FilePath: \dooringx\packages\dooringx-example\src\pages\document.ejs | ||||
| --> | ||||
| <!DOCTYPE html> | ||||
| @@ -10,7 +10,7 @@ | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
|     <meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;"> | ||||
|     <title>Dooringx-example</title> | ||||
|     <meta name="description" content="DooringX是一款功能强大,开源免费的H5可视化页面搭建框架,致力于提供一套简单方便、专业可靠、无限可能的H5落地页最佳实践。"> | ||||
|     <meta name="keywords" content="H5,H5制作网站,H5在线制作页面,HTML5,javascript,react,nodejs,前端开发,github,开源"> | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * @Author: yehuozhili | ||||
|  * @Date: 2021-07-07 14:32:55 | ||||
|  * @LastEditors: yehuozhili | ||||
|  * @LastEditTime: 2021-08-05 15:27:21 | ||||
|  * @LastEditTime: 2022-04-25 00:32:32 | ||||
|  * @FilePath: \dooringx\packages\dooringx-example\src\plugin\formComponents\input.tsx | ||||
|  */ | ||||
| import { deepCopy, UserConfig } from 'dooringx-lib'; | ||||
|   | ||||
| @@ -2,7 +2,7 @@ | ||||
|  * @Author: yehuozhili | ||||
|  * @Date: 2021-07-07 14:35:38 | ||||
|  * @LastEditors: yehuozhili | ||||
|  * @LastEditTime: 2022-04-24 20:42:01 | ||||
|  * @LastEditTime: 2022-04-27 22:24:23 | ||||
|  * @FilePath: \dooringx\packages\dooringx-example\src\plugin\registComponents\button.tsx | ||||
|  */ | ||||
|  | ||||
| @@ -13,6 +13,7 @@ import { | ||||
| 	ComponentItemFactory, | ||||
| 	createPannelOptions, | ||||
| 	useDynamicAddEventCenter, | ||||
| 	useRegistFunc, | ||||
| } from 'dooringx-lib'; | ||||
| import { FormMap } from '../formTypes'; | ||||
| import { ComponentRenderConfigProps } from 'dooringx-lib/dist/core/components/componentItem'; | ||||
| @@ -33,45 +34,41 @@ function ButtonTemp(pr: ComponentRenderConfigProps) { | ||||
|  | ||||
| 	const [text, setText] = useState(''); | ||||
| 	const op1 = props.op1; | ||||
| 	useEffect(() => { | ||||
| 		let unRegist = () => {}; | ||||
| 		if (op1) { | ||||
| 			const functionCenter = eventCenter.getFunctionCenter(); | ||||
| 			unRegist = functionCenter.register({ | ||||
| 				id: `${pr.data.id}+changeText`, | ||||
| 				fn: async (ctx, next, config, args: any, _eventList, iname) => { | ||||
| 					const userSelect = iname.data; | ||||
| 					const ctxVal = changeUserValue( | ||||
| 						userSelect['改变文本数据源'], | ||||
| 						args, | ||||
| 						'_changeval', | ||||
| 						config, | ||||
| 						ctx | ||||
| 					); | ||||
| 					const text = ctxVal[0]; | ||||
| 					setText(text); | ||||
| 					next(); | ||||
| 				}, | ||||
| 				config: [ | ||||
| 					{ | ||||
| 						name: '改变文本数据源', | ||||
| 						data: ['ctx', 'input', 'dataSource'], | ||||
| 						options: { | ||||
| 							receive: '_changeval', | ||||
| 							multi: false, | ||||
| 						}, | ||||
|  | ||||
| 	const fn = useMemo(() => { | ||||
| 		const functionCenter = eventCenter.getFunctionCenter(); | ||||
| 		return functionCenter.register({ | ||||
| 			id: `${pr.data.id}+changeText`, | ||||
| 			fn: async (ctx, next, config, args: any, _eventList, iname) => { | ||||
| 				const userSelect = iname.data; | ||||
| 				const ctxVal = changeUserValue( | ||||
| 					userSelect['改变文本数据源'], | ||||
| 					args, | ||||
| 					'_changeval', | ||||
| 					config, | ||||
| 					ctx | ||||
| 				); | ||||
| 				const text = ctxVal[0]; | ||||
| 				setText(text); | ||||
| 				next(); | ||||
| 			}, | ||||
| 			config: [ | ||||
| 				{ | ||||
| 					name: '改变文本数据源', | ||||
| 					data: ['ctx', 'input', 'dataSource'], | ||||
| 					options: { | ||||
| 						receive: '_changeval', | ||||
| 						multi: false, | ||||
| 					}, | ||||
| 				], | ||||
| 				name: `${pr.data.id}+改变文本函数`, | ||||
| 				componentId: pr.data.id, | ||||
| 			}); | ||||
| 		} | ||||
| 		return () => { | ||||
| 			if (pr.context === 'preview') { | ||||
| 				unRegist(); // 必须在预览时注销,否则影响二次点击效果,不在预览注销影响编辑时跨弹窗 | ||||
| 			} | ||||
| 		}; | ||||
| 	}, [op1]); | ||||
| 				}, | ||||
| 			], | ||||
| 			name: `${pr.data.id}+改变文本函数`, | ||||
| 			componentId: pr.data.id, | ||||
| 		}); | ||||
| 	}, []); | ||||
|  | ||||
| 	useRegistFunc(op1, pr.context, fn); | ||||
|  | ||||
| 	return ( | ||||
| 		<Button | ||||
| 			style={{ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 yehuozhili
					yehuozhili