Skip to content

Commit 04a3afa

Browse files
committed
feat: taro和h5统一一套
1 parent 8d8aa9a commit 04a3afa

5 files changed

Lines changed: 8 additions & 242 deletions

File tree

packages/nutui-taro-demo/src/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component } from 'react'
2-
import { initScaleF } from '@/utils/scale-f.taro'
2+
import { initScaleF } from '@/utils/scale-f'
33
import('@/sites/assets/styles/reset.scss')
44
import('@/packages/nutui.react.scss.taro')
55
import('@nutui/touch-emulator')
@@ -12,7 +12,7 @@ class App extends Component {
1212

1313
componentDidMount() {
1414
// 写入 :root 的 --nut-scale-f / --nut-scale-font / --nut-scale-icon,与组件内 scale-* 一致
15-
this.disposeScale = initScaleF()
15+
this.disposeScale = initScaleF('elderly')
1616
}
1717

1818
componentWillUnmount() {

src/packages/popup/popup.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
position: absolute;
5050
top: $popup-title-padding;
5151
right: $popup-title-padding;
52-
52+
display: flex;
53+
align-items: center;
54+
justify-content: center;
5355
z-index: 1;
5456
width: $popup-icon-size;
5557
height: $popup-icon-size;

src/utils/index.taro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export * from './taro/px-transform'
2626
export * from './raf'
2727
export * from './render'
2828
export * from './rubberband'
29-
export * from './scale-f.taro'
29+
export * from './scale-f'
3030
export * from './sleep'
3131
export * from './supports-passive'
3232
export * from './to-array'

src/utils/scale-f.taro.ts

Lines changed: 0 additions & 237 deletions
This file was deleted.

src/utils/scale-f.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* 响应式缩放系数(--nut-scale-f):结合京东站内原生桥与站外视口规则,
3-
* 写入根节点 CSS 变量,供布局/字号/icon 等按比例换算(见 calcByProfile)。
3+
* 写入根节点 CSS 变量(--nut-scale-f / --nut-scale-font / --nut-scale-icon),
4+
* 供布局/字号/icon 等按比例换算(见 calcByProfile)。H5 与 Taro WebView 共用此实现。
45
*/
56
import { canUseDom } from './can-use-dom'
67

0 commit comments

Comments
 (0)