1234567891011121314151617181920212223242526272829303132 |
- var style = require('../wxs/style.wxs');
- var addUnit = require('../wxs/add-unit.wxs');
- function rootStyle(data) {
- return style([
- {
- width: addUnit(data.width),
- height: addUnit(data.height),
- 'border-radius': addUnit(data.radius),
- },
- data.radius ? 'overflow: hidden' : null,
- ]);
- }
- var FIT_MODE_MAP = {
- none: 'center',
- fill: 'scaleToFill',
- cover: 'aspectFill',
- contain: 'aspectFit',
- widthFix: 'widthFix',
- heightFix: 'heightFix',
- };
- function mode(fit) {
- return FIT_MODE_MAP[fit];
- }
- module.exports = {
- rootStyle: rootStyle,
- mode: mode,
- };
|