ShopModal.tsx 980 Bytes
import React, {useEffect, useState} from 'react';
import {Modal, Button, List} from 'antd';
import { useStore } from '../index';

export default function Index() {
  const {shopData, setShopData } = useStore();

  function handleCancel() {
    setShopData({visible: false, data: []});
  }

  return (
    <Modal
      destroyOnClose
      title="适用门店"
      visible={shopData.visible}
      maskClosable={false}
      onCancel={handleCancel}
      footer={[]}
    >
      <List
        size="large"
        style={{height: '300px', overflow: 'scroll'}}
        dataSource={shopData?.data || []}
        renderItem={(item: any) => <List.Item style={{justifyContent: 'center'}}>{item.shopName}</List.Item>}
      />
      <div
        style={{
            textAlign: 'center',
            marginTop: 12,
            height: 32,
            lineHeight: '32px',
          }}
      ><Button type="primary" onClick={handleCancel}>返回</Button>
      </div>
    </Modal>
  );
}