/** @Author: Aiden* @Date: 2020年09月01日 16:40:59* @LastEditTime: 2021年04月18日 22:35:03* @LastEditors: Aiden* @Description: This is the development environment used to test the public components of dd-editor.(这是开发环境用于测试dd-editor公共组件的.)*/import React from 'react'import ReactDOM from 'react-dom'import data from '@/data.json'import { Select, Input } from 'antd'import 'antd/dist/antd.css'import DDEditor, { useUpdated } from '../src/index'// import DDEditor from "../dist/index.js";const { Option } = Selectconst NodeContainer = (info) => {console.log('info=', info)let renders = nullconst newInfo = Object.assign({}, info)const onChange = (value) => {newInfo.valueId = value// 数据改变的时候通过useUpdated传递修改的某个节点新数据过去useUpdated(newInfo)}switch (info.type) {case 1:renders = (<div><SelectdefaultValue="1"style={{ width: '120px' }}onChange={onChange}><Option value="1">{info.title}</Option><Option value="2">jack22</Option><Option value="3">mark</Option><Option value="4">jim</Option></Select><input /></div>)breakcase 2:renders = (<div><button>info.title</button></div>)breakcase 3:renders = (<div><SelectdefaultValue="1"style={{ width: '120px' }}onChange={onChange}><Option value="1">{info.title}</Option><Option value="2">look</Option><Option value="3">jason</Option><Option value="4">mark</Option></Select></div>)breakdefault:renders = <Input id={info.id} />}return renders}const uFn = (newTreeData) => {console.log('newTreeData=', newTreeData)}const Dev = () => {return (<React.Fragment><DDEditortreeData={data}NodeContainer={NodeContainer}updateDataFn={uFn}></DDEditor></React.Fragment>)}ReactDOM.render(<Dev />, document.getElementById('root')) //app即为挂载点,在模板html中。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。