|
@@ -0,0 +1,77 @@
|
|
|
+import { defineComponent, reactive } from "vue";
|
|
|
+import { useEditor } from "../..";
|
|
|
+import { useDialog } from "queenjs/api/feedback";
|
|
|
+
|
|
|
+import {Input, Select, Button, Form} from "ant-design-vue"
|
|
|
+
|
|
|
+const layout = {
|
|
|
+ labelCol: { span: 6 },
|
|
|
+ wrapperCol: { span: 18 },
|
|
|
+};
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ setup() {
|
|
|
+
|
|
|
+ const modal = useDialog();
|
|
|
+
|
|
|
+ const formState: { [name: string]: any } = reactive({
|
|
|
+ title:"",
|
|
|
+ type: "comp"
|
|
|
+ });
|
|
|
+ const rules = reactive({
|
|
|
+ title: [
|
|
|
+ { required: true, message: "名称不能为空", trigger: "change" },
|
|
|
+ {
|
|
|
+ min: 2,
|
|
|
+ max: 20,
|
|
|
+ message: "长度为2~20位字符",
|
|
|
+ trigger: "change",
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ type: [{ required: true, message: "类型不能为空", trigger: "change" },]
|
|
|
+ });
|
|
|
+
|
|
|
+ const { validate, validateInfos } = Form.useForm(formState, rules);
|
|
|
+ function submit() {
|
|
|
+
|
|
|
+ console.log("xxx");
|
|
|
+
|
|
|
+ validate().then(async () => {
|
|
|
+ modal.submit(formState);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ return () => {
|
|
|
+
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <Form {...layout} onSubmit={submit}>
|
|
|
+ <Form.Item {...validateInfos.title} label="名称">
|
|
|
+ <Input
|
|
|
+ placeholder={"请输入名称"}
|
|
|
+ v-model={[formState.title, "value"]}
|
|
|
+ />
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item {...validateInfos.type} label="类型">
|
|
|
+ <Select
|
|
|
+ v-model={[formState.type, "value"]}
|
|
|
+ >
|
|
|
+ <Select.Option value="comp">组件</Select.Option>
|
|
|
+ <Select.Option value="text">文字</Select.Option>
|
|
|
+ <Select.Option value="shape">形状</Select.Option>
|
|
|
+ </Select>
|
|
|
+ </Form.Item>
|
|
|
+
|
|
|
+ <Form.Item style={{ marginBottom: 0 }} wrapperCol={{ span: 24 }}>
|
|
|
+ <Button block type="primary" htmlType="submit">
|
|
|
+ 确定
|
|
|
+ </Button>
|
|
|
+ </Form.Item>
|
|
|
+ </Form>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ };
|
|
|
+ },
|
|
|
+});
|