omi-mp - using rpx of omi(v4.0.26+)
This commit is contained in:
parent
5d66297382
commit
a0dc34d463
|
@ -22,7 +22,7 @@ gulp.task('components', ['copy'], () => {
|
|||
file.contents = Buffer.concat([
|
||||
new Buffer(
|
||||
`${importStr}import componentCss from './${name}.wxss'
|
||||
import { h, WeElement } from 'omi'
|
||||
import { h, WeElement, rpx } from 'omi'
|
||||
import { setData } from '../../../utils/set-data'
|
||||
|
||||
`
|
||||
|
@ -74,7 +74,7 @@ Object.keys(mpOption.methods).forEach(key => {
|
|||
})
|
||||
|
||||
function css() {
|
||||
return rpx2px(componentCss)
|
||||
return rpx(componentCss)
|
||||
}
|
||||
|
||||
${hyperscript}
|
||||
|
@ -109,7 +109,7 @@ gulp.task('pages', ['copy'], () => {
|
|||
new Buffer(
|
||||
`${importStr}import appCss from '../../app.wxss'
|
||||
import pageCss from './${name}.wxss'
|
||||
import { h, WeElement } from 'omi'
|
||||
import { h, WeElement, rpx } from 'omi'
|
||||
import { setData } from '../../../utils/set-data'
|
||||
|
||||
`
|
||||
|
@ -150,7 +150,7 @@ Object.keys(mpOption).forEach(key => {
|
|||
})
|
||||
|
||||
function css() {
|
||||
return rpx2px(appCss + pageCss)
|
||||
return rpx(appCss + pageCss)
|
||||
}
|
||||
|
||||
${hyperscript}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import componentCss from './my-child.wxss'
|
||||
import { h, WeElement } from 'omi'
|
||||
import { h, WeElement, rpx } from 'omi'
|
||||
import { setData } from '../../../utils/set-data'
|
||||
|
||||
// components/my-child/my-child.js
|
||||
|
@ -68,7 +68,7 @@ Object.keys(mpOption.methods).forEach(key => {
|
|||
})
|
||||
|
||||
function css() {
|
||||
return rpx2px(componentCss)
|
||||
return rpx(componentCss)
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import '../my-child/my-child'
|
||||
import componentCss from './my-ele.wxss'
|
||||
import { h, WeElement } from 'omi'
|
||||
import { h, WeElement, rpx } from 'omi'
|
||||
import { setData } from '../../../utils/set-data'
|
||||
|
||||
// components/my-ele/my-ele.js
|
||||
|
@ -70,7 +70,7 @@ Object.keys(mpOption.methods).forEach(key => {
|
|||
})
|
||||
|
||||
function css() {
|
||||
return rpx2px(componentCss)
|
||||
return rpx(componentCss)
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import appCss from '../../app.wxss'
|
||||
import pageCss from './index.wxss'
|
||||
import { h, WeElement } from 'omi'
|
||||
import { h, WeElement, rpx } from 'omi'
|
||||
import { setData } from '../../../utils/set-data'
|
||||
|
||||
//index.js
|
||||
|
@ -93,7 +93,7 @@ Object.keys(mpOption).forEach(key => {
|
|||
})
|
||||
|
||||
function css() {
|
||||
return rpx2px(appCss + pageCss)
|
||||
return rpx(appCss + pageCss)
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import '../../components/my-ele/my-ele'
|
||||
import appCss from '../../app.wxss'
|
||||
import pageCss from './logs.wxss'
|
||||
import { h, WeElement } from 'omi'
|
||||
import { h, WeElement, rpx } from 'omi'
|
||||
import { setData } from '../../../utils/set-data'
|
||||
|
||||
//logs.js
|
||||
|
@ -56,7 +56,7 @@ Object.keys(mpOption).forEach(key => {
|
|||
})
|
||||
|
||||
function css() {
|
||||
return rpx2px(appCss + pageCss)
|
||||
return rpx(appCss + pageCss)
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
|
|
@ -32,13 +32,6 @@ wx.getSystemInfoSync = function() {
|
|||
|
||||
wx.getUserInfo = function() {}
|
||||
|
||||
//用户可以有个开关不转
|
||||
window.rpx2px = function(str) {
|
||||
return str.replace(/([1-9]\d*|0)(\.\d*)*rpx/g, (a, b) => {
|
||||
return (window.innerWidth * Number(b)) / 750 + 'px'
|
||||
})
|
||||
}
|
||||
|
||||
wx.navigateTo = function(option) {
|
||||
route.query = getUrlParams(option.url)
|
||||
route.to(option.url)
|
||||
|
|
Loading…
Reference in New Issue