Przeglądaj źródła

Merge pull request #404 from visuddhinanda/master

增加输入框
visuddhinanda 4 lat temu
rodzic
commit
2a0da06220

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

@@ -1,5 +1,7 @@
 import {Link} from 'umi';
 import {Link} from 'umi';
 import { Alert } from 'antd';
 import { Alert } from 'antd';
+import { Input } from 'antd';
+
 
 
 type IWidget1Props ={
 type IWidget1Props ={
   message: String
   message: String
@@ -63,10 +65,15 @@ export const WidgetWikiPaliArticle = (content: IWidgetArticle) => {
 }
 }
 
 
 export const WidgetWikiPaliArticleEdit = (content: IWidgetArticle) => {
 export const WidgetWikiPaliArticleEdit = (content: IWidgetArticle) => {
+  const onChange = e => {
+    console.log('Change:', e.target.value);
+  };
+
+  const { TextArea } = Input;
   return (
   return (
     <div>
     <div>
       <p>wikipali article content edit</p>
       <p>wikipali article content edit</p>
-      <textarea>{content.text}</textarea>
+      <TextArea showCount maxLength={500} defaultValue={content.text} onChange={onChange} />
     </div>
     </div>
   );
   );
 }
 }

+ 7 - 2
dashboard/src/pages/demo/course/[id]/edit.tsx

@@ -1,5 +1,7 @@
 import {Link} from 'umi';
 import {Link} from 'umi';
 import {Button} from 'antd';
 import {Button} from 'antd';
+import {Space} from 'antd';
+
 
 
 import {WidgetCourseInfo,WidgetWikiPaliArticleEdit} from '@/components/demo'
 import {WidgetCourseInfo,WidgetWikiPaliArticleEdit} from '@/components/demo'
 
 
@@ -11,8 +13,11 @@ export default ({match}) => {
       &nbsp;
       &nbsp;
       <Link to="/demo/day-2">课程主页</Link>
       <Link to="/demo/day-2">课程主页</Link>
       <h1>课程名称 {match.params.id}</h1>
       <h1>课程名称 {match.params.id}</h1>
-      <Button type="primary">保存</Button>
-      <Button >取消</Button>
+      <Space>
+        <Button type="primary">保存</Button>
+        <Button >还原</Button>        
+      </Space>
+
       
       
       <WidgetCourseInfo title="转法轮经" course_id={match.params.id} teacher_name="悟贡西亚多" />
       <WidgetCourseInfo title="转法轮经" course_id={match.params.id} teacher_name="悟贡西亚多" />
       <WidgetWikiPaliArticleEdit text="转法轮经内容 转法轮经内容 转法轮经内容 转法轮经内容"  />
       <WidgetWikiPaliArticleEdit text="转法轮经内容 转法轮经内容 转法轮经内容 转法轮经内容"  />