wechat-miniprogram / recycle-view

recycle-view: a wechat miniprogram custom component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

怎么调用transformRpx方法?

chengkaii opened this issue · comments

commented

`var ctx = createRecycleContext({
id: 'recycleId',
dataKey: 'recycleList',
page: this,
itemSize: this.itemSizeFunc
})

ctx.append(that.data.newList)
this.ctx = ctx

},
itemSizeFunc: function(item, idx) {

var that = this;
const ctxx = this.ctx
return {
  width: ctxx.transformRpx(300),
  height: 182
}

},
`

调用transformRpx方法必须有ctx实体,但是得到ctx必须知道itemSize,如果itemSizeFunc需要设置rpx单位的大小,那不是矛盾了,也就是说刚开始设置的itemSize只能是px单位的?

const transformRpx = require('./utils/transformRpx.js').transformRpx
我是这么用的

commented

WX20200610-142632@2x

commented

我眼瞎了。。