import React, { createContext, useContext } from 'react'
import { Form, Input, Radio, Select } from "antd";
import styled from "styled-components";
import { produce } from "immer";
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const Option = Select.Option;
const { customPageList } = window;
const MenuContext = createContext();
const MenuContextProvider = MenuContext.Provider;
function InputItem({ label, name }) {
const { activeMenu, formItemLayout, onChange } = useContext(MenuContext);
const rawValue = activeMenu.content.value;
const value = name ? (rawValue ? rawValue[name] : '') : rawValue;
function handleChange(e) {
const newValue = e.target.value;
onChange(name ? {
...rawValue,
[name]: newValue
} : newValue);
}
return (
)
}
export default function Editor({ activeMenu, onChange }) {
function changeType(e) {
onChange('content', produce(activeMenu.content, draft => {
draft.type = e.target.value;
draft.value = null;
}))
}
function changeValue(newValue) {
onChange('content', {
type: activeMenu.content.type,
value: newValue
})
}
const formItemLayout = {
labelCol: {span: 10},
wrapperCol: {span: 14},
};
const typeTable = {
view: {
label: '跳转网页',
content:
},
customPage: {
label: '自定义页面',
content: (
)
},
miniprogram: {
label: '跳转小程序',
content: (
<>
>
)
}
};
return (
)
}
const Root = styled.div`
margin-left: 20px;
padding: 20px;
background: #fff;
`;
const ContentValue = styled.div`
`;