From 86b8f80cc64a2f55fa4f45cefe661b76badb232d Mon Sep 17 00:00:00 2001 From: "Alex.hxy" <1872591453@qq.com> Date: Thu, 13 Mar 2025 13:48:21 +0800 Subject: [PATCH] fix: correct usages about toast --- src/packages/icon/demo.taro.tsx | 1 - src/packages/icon/demos/taro/demo6.tsx | 2 +- src/packages/icon/demos/taro/demo7.tsx | 2 +- .../infiniteloading/demos/taro/demo2.tsx | 1 - src/packages/inputnumber/demos/taro/demo3.tsx | 7 ++----- src/packages/inputnumber/demos/taro/demo8.tsx | 7 ++----- src/packages/inputnumber/demos/taro/demo9.tsx | 20 ++----------------- .../numberkeyboard/demos/taro/demo6.tsx | 1 - src/packages/progress/demos/taro/demo7.tsx | 1 - .../pulltorefresh/demos/taro/demo4.tsx | 1 - src/packages/searchbar/demos/taro/demo3.tsx | 1 - src/packages/searchbar/demos/taro/demo4.tsx | 1 - src/packages/switch/demos/taro/demo2.tsx | 1 - src/packages/switch/demos/taro/demo6.tsx | 1 - src/packages/table/demo.taro.tsx | 1 - src/packages/toast/demos/taro/demo2.tsx | 1 - src/packages/toast/doc.taro.md | 1 - 17 files changed, 8 insertions(+), 42 deletions(-) diff --git a/src/packages/icon/demo.taro.tsx b/src/packages/icon/demo.taro.tsx index 69767e0c91..93b936cf9b 100644 --- a/src/packages/icon/demo.taro.tsx +++ b/src/packages/icon/demo.taro.tsx @@ -53,7 +53,6 @@ const IconDemo = () => { { return ( <> - + {(iconfonts.IconFontConfig as any).data.map((item: any) => { return ( diff --git a/src/packages/icon/demos/taro/demo7.tsx b/src/packages/icon/demos/taro/demo7.tsx index 488a94398d..a3fe2f82f4 100644 --- a/src/packages/icon/demos/taro/demo7.tsx +++ b/src/packages/icon/demos/taro/demo7.tsx @@ -27,7 +27,7 @@ const Demo7 = () => { return ( <> - + {(iconfonts.IconFontConfig as any).style.map((item: any) => { return ( diff --git a/src/packages/infiniteloading/demos/taro/demo2.tsx b/src/packages/infiniteloading/demos/taro/demo2.tsx index 4b865632aa..22de4d4b57 100644 --- a/src/packages/infiniteloading/demos/taro/demo2.tsx +++ b/src/packages/infiniteloading/demos/taro/demo2.tsx @@ -108,7 +108,6 @@ const Demo2 = () => { { diff --git a/src/packages/inputnumber/demos/taro/demo3.tsx b/src/packages/inputnumber/demos/taro/demo3.tsx index 3c2141c059..4fbb09fa15 100644 --- a/src/packages/inputnumber/demos/taro/demo3.tsx +++ b/src/packages/inputnumber/demos/taro/demo3.tsx @@ -3,15 +3,13 @@ import { Cell, InputNumber, Toast } from '@nutui/nutui-react-taro' const Demo3 = () => { const overlimit = () => { - toastShow('超出限制事件触发', 'warn') + toastShow('超出限制事件触发') } const [show, SetShow] = useState(false) const [toastMsg, SetToastMsg] = useState('') - const [toastType, SetToastType] = useState('text') - const toastShow = (msg: any, type: string) => { + const toastShow = (msg: string) => { SetToastMsg(msg) - SetToastType(type) SetShow(true) } @@ -29,7 +27,6 @@ const Demo3 = () => { /> { diff --git a/src/packages/inputnumber/demos/taro/demo8.tsx b/src/packages/inputnumber/demos/taro/demo8.tsx index 311d283a46..f5e05b05a5 100644 --- a/src/packages/inputnumber/demos/taro/demo8.tsx +++ b/src/packages/inputnumber/demos/taro/demo8.tsx @@ -5,11 +5,9 @@ const Demo8 = () => { const [inputValue, setInputValue] = useState(0) const [show, setShow] = useState(false) const [toastMsg, setToastMsg] = useState('') - const [toastType, setToastType] = useState('text') - const toastShow = (msg: any, type: string) => { + const toastShow = (msg: any) => { setToastMsg(msg) - setToastType(type) setShow(true) } const overlimit = (e: any) => { @@ -17,7 +15,7 @@ const Demo8 = () => { } const beforeChange = (value: number | string): Promise => { - toastShow('异步演示 2 秒后更改', 'loading') + toastShow('异步演示 2 秒后更改') return new Promise((resolve) => { setTimeout(() => { @@ -39,7 +37,6 @@ const Demo8 = () => { /> { diff --git a/src/packages/inputnumber/demos/taro/demo9.tsx b/src/packages/inputnumber/demos/taro/demo9.tsx index c1f768a77e..9a1d453e68 100644 --- a/src/packages/inputnumber/demos/taro/demo9.tsx +++ b/src/packages/inputnumber/demos/taro/demo9.tsx @@ -1,18 +1,10 @@ -import React, { useState } from 'react' -import { - Cell, - InputNumber, - Toast, - ConfigProvider, -} from '@nutui/nutui-react-taro' +import React from 'react' +import { Cell, InputNumber, ConfigProvider } from '@nutui/nutui-react-taro' const Demo9 = () => { const customTheme3 = { nutuiInputnumberInputWidth: '60px', } - const [toastType, SetToastType] = useState('text') - const [show, SetShow] = useState(false) - const [toastMsg, SetToastMsg] = useState('') return ( <> @@ -40,14 +32,6 @@ const Demo9 = () => { /> - { - SetShow(false) - }} - /> ) } diff --git a/src/packages/numberkeyboard/demos/taro/demo6.tsx b/src/packages/numberkeyboard/demos/taro/demo6.tsx index a5758cb1db..f0a2292c3f 100644 --- a/src/packages/numberkeyboard/demos/taro/demo6.tsx +++ b/src/packages/numberkeyboard/demos/taro/demo6.tsx @@ -32,7 +32,6 @@ const Demo6 = () => { }} /> { diff --git a/src/packages/progress/demos/taro/demo7.tsx b/src/packages/progress/demos/taro/demo7.tsx index 322e00c313..078091f6df 100644 --- a/src/packages/progress/demos/taro/demo7.tsx +++ b/src/packages/progress/demos/taro/demo7.tsx @@ -12,7 +12,6 @@ const Demo7 = () => { {!harmony() && ( { diff --git a/src/packages/pulltorefresh/demos/taro/demo4.tsx b/src/packages/pulltorefresh/demos/taro/demo4.tsx index 910565ebca..43db2c3dc8 100644 --- a/src/packages/pulltorefresh/demos/taro/demo4.tsx +++ b/src/packages/pulltorefresh/demos/taro/demo4.tsx @@ -39,7 +39,6 @@ const Demo4 = () => { { diff --git a/src/packages/searchbar/demos/taro/demo3.tsx b/src/packages/searchbar/demos/taro/demo3.tsx index d1aa20bcb2..914818437e 100644 --- a/src/packages/searchbar/demos/taro/demo3.tsx +++ b/src/packages/searchbar/demos/taro/demo3.tsx @@ -18,7 +18,6 @@ const Demo3 = () => { toastShow()} /> { diff --git a/src/packages/searchbar/demos/taro/demo4.tsx b/src/packages/searchbar/demos/taro/demo4.tsx index 141517eab2..943760a022 100644 --- a/src/packages/searchbar/demos/taro/demo4.tsx +++ b/src/packages/searchbar/demos/taro/demo4.tsx @@ -10,7 +10,6 @@ const Demo4 = () => { <> toastShow()} /> { diff --git a/src/packages/switch/demos/taro/demo2.tsx b/src/packages/switch/demos/taro/demo2.tsx index a6adf66282..33f793cd7a 100644 --- a/src/packages/switch/demos/taro/demo2.tsx +++ b/src/packages/switch/demos/taro/demo2.tsx @@ -22,7 +22,6 @@ const Demo2 = () => { /> { diff --git a/src/packages/switch/demos/taro/demo6.tsx b/src/packages/switch/demos/taro/demo6.tsx index 8323f83aed..4a61f91535 100644 --- a/src/packages/switch/demos/taro/demo6.tsx +++ b/src/packages/switch/demos/taro/demo6.tsx @@ -20,7 +20,6 @@ const Demo6 = () => { /> { diff --git a/src/packages/table/demo.taro.tsx b/src/packages/table/demo.taro.tsx index 06c4f5c2d9..e54dab76bb 100644 --- a/src/packages/table/demo.taro.tsx +++ b/src/packages/table/demo.taro.tsx @@ -65,7 +65,6 @@ const TableDemo = () => {
{ diff --git a/src/packages/toast/demos/taro/demo2.tsx b/src/packages/toast/demos/taro/demo2.tsx index e8280a3cbe..31fe31621e 100644 --- a/src/packages/toast/demos/taro/demo2.tsx +++ b/src/packages/toast/demos/taro/demo2.tsx @@ -13,7 +13,6 @@ const Demo5 = () => { title: '函数调用函数调用', content: '函数调用函数调用函数调用函数调用函数', duration: 2, - position: 'center', icon: , lockScroll: true, onClose: () => { diff --git a/src/packages/toast/doc.taro.md b/src/packages/toast/doc.taro.md index 6c0ee67967..9d735a4019 100644 --- a/src/packages/toast/doc.taro.md +++ b/src/packages/toast/doc.taro.md @@ -68,7 +68,6 @@ import { Toast } from '@nutui/nutui-react-taro' | size | 文案尺寸,三选一 | `small` \| `base` \| `large` | `base` | | closeOnOverlayClick | 是否在点击遮罩层后关闭提示 | `boolean` | `false` | | lockScroll | 背景是否锁定 | `boolean` | `false` | -| type | 弹框类型 可选值(text、success、fail、warn、loading) | `string` | `-` | | visible | 弹窗是否显示开关 | `boolean` | `false` | | wordBreak | 换行截断方式 | `normal \| break-all \| break-word ` | `break-all` | | onClose | 关闭时触发的事件 | `Function` | `null` |