Преглед изворни кода

Merge pull request #405 from visuddhinanda/master

增加确认提示框
visuddhinanda пре 4 година
родитељ
комит
5c3900b0ee
2 измењених фајлова са 15 додато и 5 уклоњено
  1. 1 1
      dashboard/src/components/demo.tsx
  2. 14 4
      dashboard/src/pages/demo/course/[id]/edit.tsx

+ 1 - 1
dashboard/src/components/demo.tsx

@@ -73,7 +73,7 @@ export const WidgetWikiPaliArticleEdit = (content: IWidgetArticle) => {
   return (
     <div>
       <p>wikipali article content edit</p>
-      <TextArea showCount maxLength={500} defaultValue={content.text} onChange={onChange} />
+      <TextArea autoSize showCount maxLength={500} defaultValue={content.text} onChange={onChange} />
     </div>
   );
 }

+ 14 - 4
dashboard/src/pages/demo/course/[id]/edit.tsx

@@ -1,11 +1,22 @@
 import {Link} from 'umi';
-import {Button} from 'antd';
-import {Space} from 'antd';
+import {Modal, Button ,Space} from 'antd';
+import { ExclamationCircleOutlined } from '@ant-design/icons';
 
 
 import {WidgetCourseInfo,WidgetWikiPaliArticleEdit} from '@/components/demo'
 
+
 export default ({match}) => {
+  function confirm() {
+    Modal.confirm({
+      title: '存盘',
+      icon: <ExclamationCircleOutlined />,
+      content: '保存所做的修改吗?',
+      okText: '确认',
+      cancelText: '取消',
+    });
+  }
+
   return (
     <div>
       <h1>Edit item page by id {match.params.id}</h1>
@@ -14,10 +25,9 @@ export default ({match}) => {
       <Link to="/demo/day-2">课程主页</Link>
       <h1>课程名称 {match.params.id}</h1>
       <Space>
-        <Button type="primary">保存</Button>
+        <Button type="primary" onClick={confirm}>保存</Button>
         <Button >还原</Button>        
       </Space>
-
       
       <WidgetCourseInfo title="转法轮经" course_id={match.params.id} teacher_name="悟贡西亚多" />
       <WidgetWikiPaliArticleEdit text="转法轮经内容 转法轮经内容 转法轮经内容 转法轮经内容"  />