Taro 物料市场

taro component demo

https://taro-ext.jd.com/

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


最新文章

  1. 21分钟 MySQL 入门教程(转载!!!)
  2. poj 2777(线段树的节点更新策略)
  3. SQLSERVER远程备份、恢复(转)
  4. 引入HBase依赖包带来的麻烦
  5. 简单的同步MSMQ
  6. 1934. Black Spot(spfa)
  7. 【读书札记】建立第一个Web项目
  8. 树莓派系列教程:1.环境与系统,无显示器无键盘无网线联网并使用PuTTy与VNC图形界面远程登录
  9. 微信、qq可以上网,但是浏览器却不能上网怎么办
  10. Django过滤器
  11. Tensorflow卷积神经网络[转]
  12. VirtualBox安装复制Centos6.6配置网络
  13. testng报告-extentsReports使用-klov
  14. Java 避免创建不必要的对象
  15. sql语句常用功能(null值转换为0)
  16. 项目管理工具Maven的安装
  17. TOYS
  18. uoj#119. 【UR #8】决战圆锥曲线
  19. Libevent官方代码样例学习(二)
  20. 二、DBMS_JOB(用于安排和管理作业队列)

热门文章

  1. 强制杀死进程后,进程相关的socket未必发送RST
  2. 从零搭建TypeScript与React开发环境
  3. LOJ10097和平委员会
  4. JYM虚拟机性能监控与故障处理工具
  5. Linux-apache httd.conf文件详解
  6. 我用了半年的时间,把python学到了能出书的程度
  7. UI自动化实战进阶后续
  8. 最近公共祖先(LCA)---tarjan算法
  9. HDU 1754线段树
  10. hdu4710 Balls Rearrangement(数学公式+取模)