🚑 添加按需导入聊天组件样式,更新语料库

This commit is contained in:
xujiang 2020-09-12 21:54:38 +08:00
parent 44a459dc23
commit e333ad88c4

View File

@ -1,9 +1,15 @@
import React, { useCallback, useState } from 'react'; import React, { useCallback, useState } from 'react';
import { library, generateRespones, RenderList, useRegister } from 'chatbot-antd'; import { library, generateRespones, RenderList, useRegister } from 'chatbot-antd';
import { IRouteComponentProps } from 'umi'; import { IRouteComponentProps } from 'umi';
import { Button } from 'antd'; import { Button, Avatar, Input, Modal, Popconfirm } from 'antd';
import { CustomerServiceOutlined } from '@ant-design/icons'; import { CustomerServiceOutlined } from '@ant-design/icons';
import 'antd/dist/antd.css'; // 如果直接引入antd的css会导致umi设置的对应组件的主题色失效
// import 'antd/lib/button/style/index.css';
// import 'antd/lib/avatar/style/index.css';
// import 'antd/lib/input/style/index.css';
// import 'antd/lib/modal/style/index.css';
// import 'antd/lib/popconfirm/style/index.css';
library.push( library.push(
//语料库push进去也可以不用 //语料库push进去也可以不用
{ {
@ -11,7 +17,12 @@ library.push(
reg: '你是谁', reg: '你是谁',
}, },
{ {
text: 'author is yehuozhili', text: (
<div>
<a href="https://github.com/MrXujiang">@徐小夕</a>
<a href="https://github.com/yehuozhili/learnsinglespa">@yehuozhili</a>
</div>
),
useReg: /(.*?)作者是谁(.*?)/, useReg: /(.*?)作者是谁(.*?)/,
}, },
); );
@ -39,7 +50,7 @@ export default function Layout({ children }: IRouteComponentProps) {
title: 'h5-Dooring机器人客服', title: 'h5-Dooring机器人客服',
}, },
{}, {},
<div>welcome!使h5-Dooring</div>, <div>welcome!使h5-Dooring</div>,
); );
return ( return (
<div> <div>
@ -47,7 +58,7 @@ export default function Layout({ children }: IRouteComponentProps) {
style={{ style={{
position: 'fixed', position: 'fixed',
right: `${modalOpen ? '-100%' : '10px'}`, right: `${modalOpen ? '-100%' : '10px'}`,
top: '40%', bottom: '80px',
transition: 'all 0.5s ease-in-out', transition: 'all 0.5s ease-in-out',
zIndex: 2, zIndex: 2,
}} }}