ReactToastify 位置在 React 中不起作用
ReactToastify position not working in React
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 />
)
}
只需设置位置属性
<ToastContainer position="bottom-right"/>
您必须将位置定义为 ToastContainer
上的道具
<ToastContainer position="bottom-right" />
就用位置
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 />
)
}
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 />
)
}
只需设置位置属性
<ToastContainer position="bottom-right"/>
您必须将位置定义为 ToastContainer
<ToastContainer position="bottom-right" />
就用位置
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 />
)
}