From 88a8b6334c27b125aaefd5f06405390ec102b6a3 Mon Sep 17 00:00:00 2001 From: oasis Date: Wed, 9 Apr 2025 14:31:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(v15):=20swipe=20=E5=A2=9E=E5=8A=A0=20v15?= =?UTF-8?q?=20=E7=9A=84=20demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/packages/swipe/demos/h5/demo2.tsx | 26 +++++++++++++------------ src/packages/swipe/demos/taro/demo2.tsx | 26 +++++++++++++------------ src/packages/swipe/swipe.taro.tsx | 4 ++-- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/packages/swipe/demos/h5/demo2.tsx b/src/packages/swipe/demos/h5/demo2.tsx index 50b2f0a04d..bcbe40b775 100644 --- a/src/packages/swipe/demos/h5/demo2.tsx +++ b/src/packages/swipe/demos/h5/demo2.tsx @@ -7,8 +7,8 @@ const ViewNode = (text: string, style: any) => {
{ return ( <> <> - {ViewNode('设置常买', { - background: '#F8F8F8', - color: '#1A1A1A', + {ViewNode('加常买', { + background: '#fff4e8', + color: '#b5691a', })} - {ViewNode('移入收藏', { - background: '#ffcc00', + {ViewNode('收藏', { + background: '#ffbf00', color: '#FFF', })} {ViewNode('看相似', { - background: '#FF860D', + background: '#ff791a', color: '#FFF', })} {ViewNode('删除', { - background: '#FA2C19', + background: '#ff0f23', color: '#FFF', })} diff --git a/src/packages/swipe/demos/taro/demo2.tsx b/src/packages/swipe/demos/taro/demo2.tsx index 316ed74111..f575dbec02 100644 --- a/src/packages/swipe/demos/taro/demo2.tsx +++ b/src/packages/swipe/demos/taro/demo2.tsx @@ -10,8 +10,8 @@ const ViewNode = (text: string, style: any) => { { return ( <> <> - {ViewNode('设置常买', { - backgroundColor: '#F8F8F8', - color: '#1A1A1A', + {ViewNode('加常买', { + background: '#fff4e8', + color: '#b5691a', })} - {ViewNode('移入收藏', { - backgroundColor: '#ffcc00', + {ViewNode('收藏', { + background: '#ffbf00', color: '#FFF', })} {ViewNode('看相似', { - backgroundColor: '#FF860D', + background: '#ff791a', color: '#FFF', })} {ViewNode('删除', { - backgroundColor: '#FA2C19', + background: '#ff0f23', color: '#FFF', })} diff --git a/src/packages/swipe/swipe.taro.tsx b/src/packages/swipe/swipe.taro.tsx index d74108cf28..0d78f08f24 100644 --- a/src/packages/swipe/swipe.taro.tsx +++ b/src/packages/swipe/swipe.taro.tsx @@ -9,7 +9,7 @@ import React, { import classNames from 'classnames' import { ITouchEvent, View } from '@tarojs/components' import { BaseEventOrig } from '@tarojs/components/types/common' -import { useReady } from '@tarojs/taro' +import { nextTick, useReady } from '@tarojs/taro' import { useTouch } from '@/hooks/use-touch' import { getRectByTaro } from '@/utils/get-rect-by-taro' import { ComponentDefaults } from '@/utils/typings' @@ -58,7 +58,7 @@ export const Swipe = forwardRef< setActionWidth((v: any) => ({ ...v, right: rightRect.width })) } } - setTimeout(() => getWidth()) + nextTick(() => getWidth()) }) const { children, className, style } = { ...defaultProps, ...props }