Your Name 2 anni fa
parent
commit
1f3892f6e7

+ 22
- 0
src/pages/dish/list/components/DishCotent.jsx Vedi File

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 Vedi File

2
 import { queryTable } from '@/utils/request';
2
 import { queryTable } from '@/utils/request';
3
 import { PageContainer, ProTable } from '@ant-design/pro-components';
3
 import { PageContainer, ProTable } from '@ant-design/pro-components';
4
 import { useNavigate, Link } from 'react-router-dom';
4
 import { useNavigate, Link } from 'react-router-dom';
5
-import { Button, message, Popconfirm } from 'antd';
5
+import { Button, message, Popconfirm, Popover } from 'antd';
6
 import { useRef, useState } from 'react';
6
 import { useRef, useState } from 'react';
7
+import DishCotent from './components/DishCotent';
7
 
8
 
8
 const DishList = (props) => {
9
 const DishList = (props) => {
9
   console.log(props, '===');
10
   console.log(props, '===');
34
     {
35
     {
35
       title: '菜肴名称',
36
       title: '菜肴名称',
36
       dataIndex: 'name',
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
     {