Taro 物料市场
Taro 物料市场
taro component demo
https://taro-ext.jd.com/plugin/view/5caab6c68c36ac0048ace8df
https://taro-ext.jd.com/plugin/view/5e6a0a1acbca8f0850956daa
https://github.com/haomo-studio/hm-taro-information-card/blob/master/index.jsx
css in js
flex & Taro.pxTransform & boxSizing: 'border-box',
import Taro from '@tarojs/taro';
export default {
hmInformationCard: {
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'center',
width: Taro.pxTransform(750),
height: Taro.pxTransform(596)
},
box: {
display: 'flex',
alignItems: 'flex-start',
flexDirection: 'column',
justifyContent: 'center',
borderRadius: Taro.pxTransform(39),
boxShadow: '0px 10px 30px rgba(209, 213, 223, 0.50)',
backgroundColor: '#ffffff',
width: Taro.pxTransform(721),
height: Taro.pxTransform(518)
},
hd: {
boxSizing: 'border-box',
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
justifyContent: 'space-between',
paddingRight: Taro.pxTransform(62),
paddingLeft: Taro.pxTransform(58),
width: Taro.pxTransform(721),
height: Taro.pxTransform(80)
},
container: { display: 'flex', flexDirection: 'row' },
tagWrap: {
boxSizing: 'border-box',
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
borderRadius: Taro.pxTransform(39),
backgroundColor: '#fec4b0',
paddingRight: Taro.pxTransform(18),
paddingLeft: Taro.pxTransform(16),
height: Taro.pxTransform(80)
},
tag: {
opacity: 1,
textAlign: 'center',
lineHeight: Taro.pxTransform(35),
whiteSpace: 'nowrap',
color: '#f64000',
fontSize: Taro.pxTransform(23),
fontWeight: 400
},
nameClass: {
display: 'flex',
alignItems: 'flex-start',
flexDirection: 'column',
marginLeft: Taro.pxTransform(29),
height: Taro.pxTransform(80)
},
wrap: { display: 'flex', flexDirection: 'row', marginTop: Taro.pxTransform(2) },
alexander: {
opacity: 1,
width: Taro.pxTransform(109),
height: Taro.pxTransform(41),
lineHeight: Taro.pxTransform(41),
whiteSpace: 'nowrap',
color: '#141821',
fontSize: Taro.pxTransform(27),
fontWeight: 400
},
dataClass: { display: 'flex', flexDirection: 'row' },
data: {
opacity: 1,
width: Taro.pxTransform(187),
height: Taro.pxTransform(35),
lineHeight: Taro.pxTransform(35),
whiteSpace: 'nowrap',
color: '#858997',
fontSize: Taro.pxTransform(23),
fontWeight: 400
},
titleImg: { width: Taro.pxTransform(35), height: Taro.pxTransform(8) },
summaryClass: {
display: 'flex',
position: 'relative',
flexDirection: 'row',
justifyContent: 'center',
marginTop: Taro.pxTransform(49),
width: Taro.pxTransform(719),
height: Taro.pxTransform(94)
},
summary: {
position: 'relative',
opacity: 1,
width: Taro.pxTransform(592),
height: Taro.pxTransform(94),
overflow: 'hidden',
textOverflow: 'ellipsis',
lineHeight: Taro.pxTransform(47),
color: '#141821',
fontSize: Taro.pxTransform(31),
fontWeight: 400
},
word: {
position: 'absolute',
top: Taro.pxTransform(47),
left: Taro.pxTransform(526),
opacity: 1,
lineHeight: Taro.pxTransform(47),
whiteSpace: 'nowrap',
color: '#141821',
fontFamily: 'Helvetica',
fontSize: Taro.pxTransform(31),
fontWeight: 'normal'
},
ft: {
display: 'flex',
alignItems: 'center',
flexDirection: 'row',
marginTop: Taro.pxTransform(132),
height: Taro.pxTransform(47)
},
shoucang: { marginLeft: Taro.pxTransform(64), width: Taro.pxTransform(35), height: Taro.pxTransform(29) },
num: {
opacity: 1,
marginLeft: Taro.pxTransform(16),
width: Taro.pxTransform(53),
height: Taro.pxTransform(47),
lineHeight: Taro.pxTransform(47),
whiteSpace: 'nowrap',
color: '#141821',
fontFamily: 'Helvetica',
fontSize: Taro.pxTransform(31),
fontWeight: 'normal'
},
like: {
opacity: 1,
width: Taro.pxTransform(62),
height: Taro.pxTransform(47),
lineHeight: Taro.pxTransform(47),
whiteSpace: 'nowrap',
color: '#141821',
fontSize: Taro.pxTransform(31),
fontWeight: 400
}
};
网易严选
https://github.com/qit-team/taro-yanxuan/blob/master/config/index.js
https://github.com/qit-team/taro-yanxuan/blob/master/src/components/popup/index.js
https://github.com/qit-team/taro-yanxuan/blob/master/src/components/popup/index.scss
this.props.children
ScrollView & style height
import Taro, { Component } from '@tarojs/taro'
import { View, ScrollView, Image } from '@tarojs/components'
import classNames from 'classnames'
import closeIcon from './assets/close.png'
import './index.scss'
export default class Popup extends Component {
static defaultProps = {
visible: false,
compStyle: '',
onClose: () => {}
}
constructor (props) {
super(props)
this.state = {
isShow: props.visible
}
}
componentWillReceiveProps (nextProps) {
const { visible } = nextProps
const { isShow } = this.state
if (visible !== isShow) {
this.setState({
isShow: visible
})
}
}
handleClose = () => {
this.props.onClose()
}
handleTouchMove = e => {
e.stopPropagation()
}
render () {
const { onClose, compStyle } = this.props
const { isShow } = this.state
return (
<View
className={classNames('comp-popup', isShow && 'comp-popup--visible')}
onTouchMove={this.handleTouchMove}
style={compStyle}
>
<View className='comp-popup__mask' onClick={onClose} />
<View className='comp-popup__wrapper'>
<ScrollView
scrollY
className='comp-popup__content'
style={{ height: Taro.pxTransform(750) }}
>
{this.props.children}
</ScrollView>
<View className='comp-popup__close' onClick={onClose}>
<Image className='comp-popup__close-img' src={closeIcon} />
</View>
</View>
</View>
)
}
}
scss & flex
@import '@styles/theme.scss';
.comp-popup {
position: absolute;
width: 100%;
height: 0;
top: 0;
left: 0;
z-index: 9;
display: flex;
flex-direction: column;
overflow: hidden;
// NOTE RN 没有 display: none,暂时用 height 实现同等效果
&--visible {
height: 100%;
}
}
.comp-popup__mask {
flex: 1;
width: 100%;
background: rgba(0, 0, 0, 0.25);
}
.comp-popup__wrapper {
position: absolute;
bottom: 0;
width: 100%;
background: #ffffff;
}
.comp-popup__content {
}
.comp-popup__close {
position: absolute;
top: 22px;
right: 22px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 48px;
height: 48px;
&-img {
width: 24px;
height: 24px;
}
}
Taro.pxTransform
css in js
https://nervjs.github.io/taro/docs/size.html#api
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/12571414.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2017-03-25 Angular 2 Tutorial 2017 All In One
2016-03-25 读写 LED 作业 台灯的 频闪研究1
2016-03-25 常用特殊字符大全!
2016-03-25 Microsoft Remote Desktop: Microsoft Remote Desktop - 微软官方免费远程桌面控制Windows的软件