amis Toast Action 不展示,已配置 env.notify 并加载 < ToastComponent />

mlnl4t2r  于 2个月前  发布在  其他
关注(0)|答案(3)|浏览(39)
描述问题:

请用一段清晰简洁的文字描述问题是什么...

Toast Action 不展示,已配置 env.notify 并加载

截图或视频:

可以的话,尽可能提供截图或视频来补充描述你的问题...

  1. Action 成功触发


2. 显示 toastRef 仍为 null,进入不展示逻辑

如何复现(请务必完整填写下面内容):
  1. 你是如何使用 amis 的?
    sdknpm其他 ...
    sdk
  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    "amis": "3.4.0-beta.12",
  3. 粘贴有问题的完整 amis schema 代码:
import {
  AlertComponent,
  ToastComponent,
  ToastConf,
  ToastLevel,
  render as renderAmis,
} from 'amis';
import { toast } from 'amis-ui';

import 'amis/lib/themes/antd.css';
import 'amis/lib/helper.css';
import 'amis/sdk/iconfont.css';

const LiveUIDJSON = {
  type: 'page',
  body: [
    {
      type: 'flex',
      justify: 'space-between',
      alignItems: 'center',
      items: [
    {
      type: 'form',
      wrapWithPanel: false,
      // api: '/api/v1/test',
      body: [
        {
          name: 'excel',
          label: 'Import File',
          type: 'input-excel',
          level: 'primary',
          className: 'm-b-sm',
          onEvent: {
            change: {
              actions: [
                {
                  actionType: 'toast',
                  args: {
                    msgType: 'success',
                    msg: 'Upload Success!',
                  },
                  
                },
              ],
            },
          },
        },
  ],
};

const ENV = {
  getModalContainer: () => document.querySelector('.amis-scope'),
  notify: (type: ToastLevel, msg: string, conf?: ToastConf) =>
    toast[type] ? toast[type](msg, conf) : console.warn('[Notify]', type, msg),
  theme: 'antd',
};

export const Component = () => (
  <div style={{ padding: '10px 30px' }}>
    <ToastComponent key="toast" />
    <AlertComponent key="alert" />
    {renderAmis(LiveUIDJSON, { locale: 'en-US' }, ENV)}
  </div>
);
  1. 操作步骤
    请简单描述一下复现的操作步骤...
    执行
8xiog9wr

8xiog9wr1#

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

kd3sttzy

kd3sttzy2#

这个 issue 有人看么?

eit6fx6z

eit6fx6z3#

可能要在 <ToastComponent key="toast" /> 中 加 theme={theme} 。

我用了 Alter, 改用 antd 主题,也是发现 Alter 对话框不显示,但是dom中已经有了 alter dialog 的相关dom,只是用到的的 css 是 amis-dialog-widget cxd-Modal cxd-Modal--1th , 然后改为 ,生成的 css就是 amis-dialog-widget antd-Modal antd-Modal--1th ,然后就能正常显示。

相关问题