0

toastify/dist/ReactToastify.css` 我无法管理 Toast 以显示在右下角。我正在使用确切的代码作为文档。但它不工作

import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css'; 
toast.configure();

function myComponent () {
   
   ...
   const submit = () => {
       toast.success('Your Message was sent to Wasfa Team', { poistion: toast.POSITION.BOTTOM_RIGHT });
   }
   ...
   return (
     ...
     <ToastContainer />
   )
}
4

3 回答 3

1

只需设置位置属性

   <ToastContainer position="bottom-right"/>
于 2021-08-02T06:49:07.637 回答
1

您必须将位置定义为道具ToastContainer

<ToastContainer position="bottom-right" />
于 2021-08-02T06:49:21.163 回答
1

只使用位置

import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css'; 
toast.configure();

function myComponent () {
   
   ...
   const submit = () => {
       toast.success('Your Message was sent to Wasfa Team', { poistion: "bottom-right" });
   }
   ...
   return (
     ...
     <ToastContainer />
   )
}
于 2021-08-02T06:50:04.653 回答