Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

结合umi4中使用,缓存页面存在Select组件和Image组件,触发过select点击事件和图片的预览 。打开新页面回退到缓存页面的时候会出现打开图片预览的弹框和展开Select的选项的问题 #309

Closed
hannah-lin-sama opened this issue Mar 11, 2024 · 1 comment

Comments

@hannah-lin-sama
Copy link

import { KeepAlive } from '@umijs/max';
import { Image, Select } from 'antd';
import { useState } from 'react';

const PageTest = () => {
  const [count, setCount] = useState();

  return (
    <div style={{ margin: 40 }}>
      <Select
        value={count}
        options={[
          {
            value: '1',
            label: '选中1'
          },
          {
            value: '2',
            label: '选中2'
          },
          {
            value: '3',
            label: '选中3'
          },
          {
            value: '4',
            label: '选中4'
          }
        ]}
        onChange={(value) => {
          console.log('onChange', value);
          setCount(value);
        }}
      />
      <p>
        {count}
      </p>
      <Image
        height={300}
        width={500}
        src={'https://copyright.bdstatic.com/vcg/creative/cc9c744cf9f7c864889c563cbdeddce6.jpg@h_1280'}
      />
    </div>
  );
};

export default () => <KeepAlive name="test-keepalive"><PageTest /></KeepAlive>;

image

@hannah-lin-sama
Copy link
Author

添加autoFreeze={false}解决了 参考#225

@CJY0208 CJY0208 closed this as completed Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants