From b21f49e5029e1184c60f4bab570580e9f1570492 Mon Sep 17 00:00:00 2001 From: Haixing <65376724+HaixingOoO@users.noreply.github.com> Date: Tue, 20 Aug 2024 15:36:30 +0800 Subject: [PATCH] docs(popup): optimiza popup docs (#3048) * docs(popup): optimiza popup docs * chore: update snapshot --------- Co-authored-by: github-actions[bot] --- src/popup/_example/dynamic.tsx | 3 +-- src/popup/_example/visible.tsx | 5 ++-- test/snap/__snapshots__/csr.test.jsx.snap | 28 ++++------------------- test/snap/__snapshots__/ssr.test.jsx.snap | 4 ++-- 4 files changed, 10 insertions(+), 30 deletions(-) diff --git a/src/popup/_example/dynamic.tsx b/src/popup/_example/dynamic.tsx index aa38f5685b..2bc2e10d87 100644 --- a/src/popup/_example/dynamic.tsx +++ b/src/popup/_example/dynamic.tsx @@ -2,7 +2,6 @@ import React, { useState, useRef } from 'react'; import { Button, Popup } from 'tdesign-react'; export default function Controlled() { - const [visible] = useState(true); const [spanVisible, setVisible] = useState(false); const [content, setContent] = useState('这是popup内容'); const btnClicksRef = useRef(0); @@ -15,7 +14,7 @@ export default function Controlled() { }; return ( - + ); diff --git a/src/popup/_example/visible.tsx b/src/popup/_example/visible.tsx index cd02495142..0e1e34ea84 100644 --- a/src/popup/_example/visible.tsx +++ b/src/popup/_example/visible.tsx @@ -2,11 +2,12 @@ import React, { useState } from 'react'; import { Button, Popup } from 'tdesign-react'; export default function Controlled() { - const [visible] = useState(true); + const [visible, setVisible] = useState(false); return ( - + {/* 当visible=true,trigger节点无法获取元素位置,会导致popup定位异常 */} + ); } diff --git a/test/snap/__snapshots__/csr.test.jsx.snap b/test/snap/__snapshots__/csr.test.jsx.snap index 28a97d6546..7e4b78054a 100644 --- a/test/snap/__snapshots__/csr.test.jsx.snap +++ b/test/snap/__snapshots__/csr.test.jsx.snap @@ -65744,7 +65744,7 @@ exports[`csr snapshot test > csr test src/popup/_example/disabled.tsx 1`] = ` exports[`csr snapshot test > csr test src/popup/_example/dynamic.tsx 1`] = `
-
-
- 这是popup内容 -
-
`; @@ -66137,7 +66127,7 @@ exports[`csr snapshot test > csr test src/popup/_example/trigger-element.tsx 1`] exports[`csr snapshot test > csr test src/popup/_example/visible.tsx 1`] = `
-
-
- 这是popup内容 -
-
`; @@ -132963,7 +132943,7 @@ exports[`ssr snapshot test > ssr test src/popup/_example/destroy.tsx 1`] = `" ssr test src/popup/_example/disabled.tsx 1`] = `""`; -exports[`ssr snapshot test > ssr test src/popup/_example/dynamic.tsx 1`] = `"
这是popup内容
"`; +exports[`ssr snapshot test > ssr test src/popup/_example/dynamic.tsx 1`] = `""`; exports[`ssr snapshot test > ssr test src/popup/_example/placement.tsx 1`] = `"
"`; @@ -132975,7 +132955,7 @@ exports[`ssr snapshot test > ssr test src/popup/_example/trigger.tsx 1`] = `" ssr test src/popup/_example/trigger-element.tsx 1`] = `"
"`; -exports[`ssr snapshot test > ssr test src/popup/_example/visible.tsx 1`] = `"
这是popup内容
"`; +exports[`ssr snapshot test > ssr test src/popup/_example/visible.tsx 1`] = `""`; exports[`ssr snapshot test > ssr test src/progress/_example/circle.tsx 1`] = `"
默认样式
0%
不显示数字
自定义内容
75 day
进度完成
进度发生错误
进度被中断
自定义颜色
小尺寸
0%
默认尺寸
0%
大尺寸
0%
自定义尺寸
0%
"`; diff --git a/test/snap/__snapshots__/ssr.test.jsx.snap b/test/snap/__snapshots__/ssr.test.jsx.snap index 71f9831dbd..b989efc081 100644 --- a/test/snap/__snapshots__/ssr.test.jsx.snap +++ b/test/snap/__snapshots__/ssr.test.jsx.snap @@ -702,7 +702,7 @@ exports[`ssr snapshot test > ssr test src/popup/_example/destroy.tsx 1`] = `" ssr test src/popup/_example/disabled.tsx 1`] = `""`; -exports[`ssr snapshot test > ssr test src/popup/_example/dynamic.tsx 1`] = `"
这是popup内容
"`; +exports[`ssr snapshot test > ssr test src/popup/_example/dynamic.tsx 1`] = `""`; exports[`ssr snapshot test > ssr test src/popup/_example/placement.tsx 1`] = `"
"`; @@ -714,7 +714,7 @@ exports[`ssr snapshot test > ssr test src/popup/_example/trigger.tsx 1`] = `" ssr test src/popup/_example/trigger-element.tsx 1`] = `"
"`; -exports[`ssr snapshot test > ssr test src/popup/_example/visible.tsx 1`] = `"
这是popup内容
"`; +exports[`ssr snapshot test > ssr test src/popup/_example/visible.tsx 1`] = `""`; exports[`ssr snapshot test > ssr test src/progress/_example/circle.tsx 1`] = `"
默认样式
0%
不显示数字
自定义内容
75 day
进度完成
进度发生错误
进度被中断
自定义颜色
小尺寸
0%
默认尺寸
0%
大尺寸
0%
自定义尺寸
0%
"`;