|
1 | 1 | import React from 'react'
|
| 2 | +import Taro, { pxTransform } from '@tarojs/taro' |
2 | 3 | import { Image } from '@nutui/nutui-react-taro'
|
3 | 4 | import { View } from '@tarojs/components'
|
4 |
| -import { pxTransform } from '@tarojs/taro' |
5 | 5 |
|
6 | 6 | const Demo2 = () => {
|
| 7 | + const HARMONY = |
| 8 | + Taro.getEnv() === Taro.ENV_TYPE.HARMONYHYBRID || |
| 9 | + Taro.getEnv() === Taro.ENV_TYPE.HARMONY |
| 10 | + |
7 | 11 | const src =
|
8 | 12 | 'https://storage.360buyimg.com/imgtools/e067cd5b69-07c864c0-dd02-11ed-8b2c-d7f58b17086a.png'
|
9 | 13 | return (
|
10 | 14 | <>
|
11 | 15 | <View style={{ display: 'flex', flexWrap: 'wrap', flexDirection: 'row' }}>
|
12 |
| - <View style={{ width: pxTransform(90) }}> |
| 16 | + <View style={{ width: HARMONY ? pxTransform(98) : 98 }}> |
13 | 17 | <Image
|
14 | 18 | src={src}
|
15 | 19 | mode="aspectFit"
|
16 |
| - width={pxTransform(80)} |
17 |
| - height={pxTransform(80)} |
18 |
| - radius={pxTransform(40)} |
| 20 | + width={HARMONY ? pxTransform(80) : 80} |
| 21 | + height={HARMONY ? pxTransform(80) : 80} |
| 22 | + radius={HARMONY ? pxTransform(40) : 40} |
19 | 23 | />
|
20 | 24 | </View>
|
21 |
| - <View style={{ width: pxTransform(90) }}> |
| 25 | + <View style={{ width: HARMONY ? pxTransform(98) : 98 }}> |
22 | 26 | <Image
|
23 | 27 | src={src}
|
24 | 28 | mode="scaleToFill"
|
25 |
| - width={pxTransform(80)} |
26 |
| - height={pxTransform(80)} |
27 |
| - radius={pxTransform(40)} |
| 29 | + width={HARMONY ? pxTransform(80) : 80} |
| 30 | + height={HARMONY ? pxTransform(80) : 80} |
| 31 | + radius={HARMONY ? pxTransform(40) : 40} |
28 | 32 | />
|
29 | 33 | </View>
|
30 |
| - <View style={{ width: pxTransform(90) }}> |
| 34 | + <View style={{ width: HARMONY ? pxTransform(98) : 98 }}> |
31 | 35 | <Image
|
32 | 36 | src={src}
|
33 | 37 | mode="scaleToFill"
|
34 |
| - width={pxTransform(80)} |
35 |
| - height={pxTransform(80)} |
36 |
| - radius={pxTransform(10)} |
| 38 | + width={HARMONY ? pxTransform(80) : 80} |
| 39 | + height={HARMONY ? pxTransform(80) : 80} |
| 40 | + radius={HARMONY ? pxTransform(10) : 10} |
37 | 41 | />
|
38 | 42 | </View>
|
39 | 43 | </View>
|
|
0 commit comments