From 3176d522bc47f3649ce72fa0e769cc54a9729e0e Mon Sep 17 00:00:00 2001 From: tony chen Date: Wed, 17 Jan 2024 18:25:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=A4=9A=E7=AB=AF?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 19 ++-- src/pages/components/jsontree/index.weapp.tsx | 6 ++ src/pages/components/pages/text/text.tsx | 4 +- src/pages/global/index.tsx | 5 +- .../global/pages/styles/background/index.tsx | 16 +-- .../global/pages/styles/border/index.scss | 56 +++++++++- .../global/pages/styles/border/index.tsx | 36 +++---- .../global/pages/styles/box/index.config.ts | 2 +- src/pages/global/pages/styles/box/index.scss | 102 +++++++++++++++++- src/pages/global/pages/styles/box/index.tsx | 48 ++++----- src/pages/global/pages/styles/flex/index.tsx | 2 +- .../global/pages/styles/other/index.scss | 18 ++++ src/pages/global/pages/styles/other/index.tsx | 10 +- .../global/pages/styles/position/index.scss | 62 ++++++++++- .../global/pages/styles/position/index.tsx | 20 ++-- src/pages/global/pages/styles/text/index.tsx | 2 +- 16 files changed, 314 insertions(+), 94 deletions(-) create mode 100644 src/pages/components/jsontree/index.weapp.tsx diff --git a/src/app.config.ts b/src/app.config.ts index 4171414d..d7c6c185 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -54,6 +54,13 @@ const pages = [ 'pages/global/pages/router/index', 'pages/global/pages/styles/size', 'pages/global/pages/styles/platform', + 'pages/global/pages/styles/background/index', + 'pages/global/pages/styles/border/index', + 'pages/global/pages/styles/flex/index', + 'pages/global/pages/styles/other/index', + 'pages/global/pages/styles/position/index', + 'pages/global/pages/styles/box/index', + 'pages/global/pages/styles/text/index', // 全局相关 end // 组件相关 start 'pages/components/index', @@ -118,23 +125,13 @@ const pages = [ 'pages/about/rn', 'pages/webview/index', // 探索 - 'pages/explore/index' + 'pages/explore/index', ]; if (process.env.TARO_ENV !== 'harmony') { pages.push( 'pages/components/pages/virtual-list/virtual-list', ); -} else { - pages.push( - 'pages/global/pages/styles/background/index', - 'pages/global/pages/styles/border/index', - 'pages/global/pages/styles/flex/index', - 'pages/global/pages/styles/other/index', - 'pages/global/pages/styles/position/index', - 'pages/global/pages/styles/box/index', - 'pages/global/pages/styles/text/index', - ) } const subpackages = [ diff --git a/src/pages/components/jsontree/index.weapp.tsx b/src/pages/components/jsontree/index.weapp.tsx new file mode 100644 index 00000000..800c353e --- /dev/null +++ b/src/pages/components/jsontree/index.weapp.tsx @@ -0,0 +1,6 @@ +import { View, Text } from '@tarojs/components' +// import { isWeb } from '@/utils/index' + +export default (props) => { + return ((props.data && Object.keys(props.data).length > 0) ? {JSON.stringify(props.data, undefined, 2)} : ) +} \ No newline at end of file diff --git a/src/pages/components/pages/text/text.tsx b/src/pages/components/pages/text/text.tsx index 953c9fd3..9b4a8702 100644 --- a/src/pages/components/pages/text/text.tsx +++ b/src/pages/components/pages/text/text.tsx @@ -36,12 +36,12 @@ const PageView = () => { 多 空格文字(nbsp) - {/* + 不解码文字> 解码文字> - */} + diff --git a/src/pages/global/index.tsx b/src/pages/global/index.tsx index f6aeb572..858ae199 100644 --- a/src/pages/global/index.tsx +++ b/src/pages/global/index.tsx @@ -65,8 +65,7 @@ export default class Index extends Component { { id: 'platform', name: '跨平台' - } - ].concat(process.env.TARO_ENV === 'harmony' ? [ + }, { id: 'flex/index', name: 'flex' @@ -89,7 +88,7 @@ export default class Index extends Component { id: 'other/index', name: '其他' } - ] : []) + ] } ] }; diff --git a/src/pages/global/pages/styles/background/index.tsx b/src/pages/global/pages/styles/background/index.tsx index 79a1f779..706f51bb 100644 --- a/src/pages/global/pages/styles/background/index.tsx +++ b/src/pages/global/pages/styles/background/index.tsx @@ -10,7 +10,7 @@ export default function Size() { {/* 测试 background-color */} - background-color + background-color @@ -32,10 +32,10 @@ export default function Size() { - rgba(255, 0, 0) + rgb(255, 0, 0) @@ -56,7 +56,7 @@ export default function Size() { {/* 测试 background-image */} - background-image + background-image @@ -84,7 +84,7 @@ export default function Size() { {/* 测试background-size */} - background-size + background-size @@ -130,7 +130,7 @@ export default function Size() { {/* 测试background-position */} - background-position + background-position @@ -260,7 +260,7 @@ export default function Size() { {/* 测试background-repeat */} - background-repeat + background-repeat @@ -288,7 +288,7 @@ export default function Size() { - repeat-y + repeat-x - border + border border - 1px + 1px border 四边 - border-left - border-right - border-bottom - border-left + border-left + border-top + border-right + border-bottom @@ -37,24 +37,24 @@ export default function Size() { {/* 测试 border-width */} - border-width + border-width border-width - 1px - 5px - 10px + 1px + 5px + 10px border-width 四边 - top - right - bottom - left + left + top + right + bottom @@ -65,7 +65,7 @@ export default function Size() { {/* 测试 border-color */} - border-color + border-color @@ -93,7 +93,7 @@ export default function Size() { {/* 测试 border-style */} - border-style + border-style @@ -105,7 +105,7 @@ export default function Size() { - border-color 四边 + border-style 四边 top right @@ -121,7 +121,7 @@ export default function Size() { {/* 测试 border-radius */} - border-radius + border-radius diff --git a/src/pages/global/pages/styles/box/index.config.ts b/src/pages/global/pages/styles/box/index.config.ts index 27239523..6a09c0a3 100644 --- a/src/pages/global/pages/styles/box/index.config.ts +++ b/src/pages/global/pages/styles/box/index.config.ts @@ -1,3 +1,3 @@ export default definePageConfig({ - navigationBarTitleText: 'Size' + navigationBarTitleText: 'Box' }) diff --git a/src/pages/global/pages/styles/box/index.scss b/src/pages/global/pages/styles/box/index.scss index 1727ded5..f66fd880 100644 --- a/src/pages/global/pages/styles/box/index.scss +++ b/src/pages/global/pages/styles/box/index.scss @@ -1,10 +1,107 @@ + +.bg { + background: #eee; +} + .box { width: 80px; height: 80px; margin: 10px; font-size: 16px; color: #fff; + text-align: center; background: #555; + display: flex; + align-items: center; + justify-content: center; +} + +.box100 { + width: 100px; + height: 100px; +} + +.box400 { + width: 400px; + height: 400px; + background-color: white; +} + +.box-half { + width: 50%; + height: 50%; +} + +.box-50vw { + width: 50vw; +} + +.box-50vh { + height: 50vh; +} + +.box-minw200 { + min-width: 200px; +} + +.box-minw50 { + min-width: 50px; +} + +.box-minh200 { + min-height: 200px; +} + +.box-minh50 { + min-height: 50px; +} + +.box-m10 { + margin: 10px; +} + +.box-m10-2 { + margin: 10px 10px; +} + +.box-m10-3 { + margin: 10px 10px 10px; +} + +.box-m10-4 { + margin: 10px 10px 10px 10px; +} + +.box-ml10 { + margin-left: 10px; +} + +.box-mr10 { + margin-right: 10px; +} + +.box-mt10 { + margin-top: 10px; +} + +.box-mb10 { + margin-bottom: 10px; +} + +.box-pl10 { + padding-left: 10px; +} + +.box-pr10 { + padding-right: 10px; +} + +.box-pt10 { + padding-top: 10px; +} + +.box-pb10 { + padding-bottom: 10px; } .mbox { @@ -35,15 +132,10 @@ flex-direction: row; } -.bg { - background: #eee; -} - .flex { display: flex; } - .row { display: flex; flex-direction: row; diff --git a/src/pages/global/pages/styles/box/index.tsx b/src/pages/global/pages/styles/box/index.tsx index 7a444410..dbdea8f6 100644 --- a/src/pages/global/pages/styles/box/index.tsx +++ b/src/pages/global/pages/styles/box/index.tsx @@ -5,37 +5,37 @@ import './index.scss' export default function Size() { return -
+
{/* 测试 单位 */} - width height 单位 + width height 单位 height & width 单位:px - 100px + 100px height & width 单位:% - - 50% + + 50% width 单位:vw - 50vw + 50vw heigh 单位:vh - 50vh + 50vh @@ -46,31 +46,31 @@ export default function Size() { {/* 测试 最小/大 */} - 最大/小尺寸 + 最大/小尺寸 min-width: 200px - 200px + 200px max-width: 50px - 50px + 50px min-height: 200px - 200px + 200px max-height: 50px - 50px + 50px @@ -87,17 +87,17 @@ export default function Size() { margin: 10px - - + + - - + + - - + + - - + + @@ -115,16 +115,16 @@ export default function Size() { padding: 10px - + - + - + - + diff --git a/src/pages/global/pages/styles/flex/index.tsx b/src/pages/global/pages/styles/flex/index.tsx index f3099e36..6ef99056 100644 --- a/src/pages/global/pages/styles/flex/index.tsx +++ b/src/pages/global/pages/styles/flex/index.tsx @@ -10,7 +10,7 @@ export default function Size() { {/* 测试 flex-direcion */} - flex-direction + flex-direction row diff --git a/src/pages/global/pages/styles/other/index.scss b/src/pages/global/pages/styles/other/index.scss index 1997b81a..2fd6c5b4 100644 --- a/src/pages/global/pages/styles/other/index.scss +++ b/src/pages/global/pages/styles/other/index.scss @@ -27,4 +27,22 @@ .m10 { margin: 0 10px; +} + +.box300 { + width: 300px; + height: 300px; + margin: 10px; +} + +.box400 { + font-size: 40px; + display: flex; + width: 400px; + height: 400px; + opacity: 0.5; + color: white; + text-align: center; + justify-content: center; + align-items: center; } \ No newline at end of file diff --git a/src/pages/global/pages/styles/other/index.tsx b/src/pages/global/pages/styles/other/index.tsx index 3ca73f87..2b071940 100644 --- a/src/pages/global/pages/styles/other/index.tsx +++ b/src/pages/global/pages/styles/other/index.tsx @@ -10,7 +10,7 @@ export default function Size() { {/* 测试 透明度 */} - 其他 + 其他 @@ -24,11 +24,11 @@ export default function Size() { overflow - - hidden + + hidden - - visibile + + visibile diff --git a/src/pages/global/pages/styles/position/index.scss b/src/pages/global/pages/styles/position/index.scss index 4d4ff1d9..587f3828 100644 --- a/src/pages/global/pages/styles/position/index.scss +++ b/src/pages/global/pages/styles/position/index.scss @@ -14,11 +14,71 @@ .bg { background: #eee; } - +.bg-relative { + position: relative; + width: 200px; + height: 200px; + background: #ddd; +} +.box-absolute { + position: absolute; + top: 30px; + left: 30px; +} .flex { display: flex; } +.box-relative { + position: relative; + top: 30px; + left: 30px; +} + +.box-z-1 { + opacity: 0.5; + position: absolute; + top: 30px; + left: 30px; + z-index: 1; + color: red; +} + +.box-z-2 { + opacity: 0.5; + position: absolute; + top: 35px; + left: 35px; + z-index: 2; + color: orange; +} + +.box-z-3 { + opacity: 0.5; + position: absolute; + top: 40px; + left: 40px; + z-index: 3; + color: yellow; +} + +.box-z-4 { + opacity: 0.5; + position: absolute; + top: 45px; + left: 45px; + z-index: 4; + color: green; +} + +.box-z-5 { + opacity: 0.5; + position: absolute; + top: 50px; + left: 50px; + z-index: 5; + color: blue; +} .row { display: flex; diff --git a/src/pages/global/pages/styles/position/index.tsx b/src/pages/global/pages/styles/position/index.tsx index 1ea90f64..ed0fcb08 100644 --- a/src/pages/global/pages/styles/position/index.tsx +++ b/src/pages/global/pages/styles/position/index.tsx @@ -11,20 +11,20 @@ export default function Size() { {/* 测试 定位 */} - position + position relative - relative 30px + relative 30px absolute - - + + absolute 30px @@ -33,12 +33,12 @@ export default function Size() { zIndex - - 1 - 2 - 3 - 4 - 5 + + 1 + 2 + 3 + 4 + 5 diff --git a/src/pages/global/pages/styles/text/index.tsx b/src/pages/global/pages/styles/text/index.tsx index 8cf0aa82..08df952a 100644 --- a/src/pages/global/pages/styles/text/index.tsx +++ b/src/pages/global/pages/styles/text/index.tsx @@ -10,7 +10,7 @@ export default function Size() { {/* 测试 文本 */} - font + font