Your Name 2 лет назад
Родитель
Сommit
1f3892f6e7
2 измененных файлов: 29 добавлений и 2 удалений
  1. 22
    0
      src/pages/dish/list/components/DishCotent.jsx
  2. 7
    2
      src/pages/dish/list/index.jsx

+ 22
- 0
src/pages/dish/list/components/DishCotent.jsx Просмотреть файл

@@ -0,0 +1,22 @@
1
+import React from 'react';
2
+import { Card } from 'antd';
3
+
4
+const { Meta } = Card;
5
+
6
+export default (props) => {
7
+
8
+  const { dish = {} } = props;
9
+
10
+  const style = {
11
+    height: dish.thumb ? '160px' : '400px',
12
+    overflowY: 'auto',
13
+  }
14
+
15
+  return (
16
+    <Card cover={<img alt='' src={dish.thumb} />} style={{ width: '360px', height: '480px' }}>
17
+      <Meta
18
+        title={dish.name}
19
+        description={<div dangerouslySetInnerHTML={{ __html: dish.content }} style={style} />} />
20
+    </Card>
21
+  )
22
+}

+ 7
- 2
src/pages/dish/list/index.jsx Просмотреть файл

@@ -2,8 +2,9 @@ import { getDishList, addDish, updataDish, deleteDish } from '@/services/dish';
2 2
 import { queryTable } from '@/utils/request';
3 3
 import { PageContainer, ProTable } from '@ant-design/pro-components';
4 4
 import { useNavigate, Link } from 'react-router-dom';
5
-import { Button, message, Popconfirm } from 'antd';
5
+import { Button, message, Popconfirm, Popover } from 'antd';
6 6
 import { useRef, useState } from 'react';
7
+import DishCotent from './components/DishCotent';
7 8
 
8 9
 const DishList = (props) => {
9 10
   console.log(props, '===');
@@ -34,7 +35,11 @@ const DishList = (props) => {
34 35
     {
35 36
       title: '菜肴名称',
36 37
       dataIndex: 'name',
37
-      render: (t, row) => <Link to={`/stock/dish/detail?id=${row.id}`}>{t}</Link>
38
+      render: (t, row) => (
39
+        <Popover placement="right" content={<DishCotent dish={row} />}>
40
+          <Link to={`/stock/dish/detail?id=${row.id}`}>{t}</Link>
41
+        </Popover>
42
+      )
38 43
     },
39 44
 
40 45
     {