fix avatar

This commit is contained in:
dntzhang 2018-11-08 11:04:36 +08:00
parent 2c6cd8c6f5
commit 6d33e04688
2 changed files with 5 additions and 13 deletions

View File

@ -3,7 +3,7 @@ import indexCss from './index.wxss'
import { h, WeElement } from 'omi'
function css() {
return appCss + indexCss
return rpx2px(appCss + indexCss)
}
function render() {
@ -45,7 +45,7 @@ const app = getApp()
const mpOption = Page({
data: {
motto: 'Hello omi-mp',
userInfo: { nickName: 'dntzhang' },
userInfo: { nickName: 'dntzhang', avatarUrl: 'https://github.com/Tencent/omi/raw/master/assets/omi-logo.svg?sanitize=true' },
hasUserInfo: false,
canIUse: wx.canIUse('button.open-type.getUserInfo')
},

View File

@ -25,18 +25,10 @@ wx.getSystemInfoSync = function () {
}
}
`width: 128rpx;
height: 54rpx;`.replace(/([0-9]*)(rpx)/g,function(a,b,c){
console.log(a,b,c)
return Number(b)
})
//用户可以有个开关不转
window.rpx2px = function(str){
return str.replace(/([0-9]*)rpx/g,function(a,b,c){
console.log(a,b,c)
window.rpx2px = function (str) {
return str.replace(/([0-9]*)rpx/g, function (a, b) {
return window.innerWidth * Number(b) / 750 + 'px'
})
}