You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by GitBox <gi...@apache.org> on 2019/05/08 09:06:08 UTC
[GitHub] [incubator-weex] ZhiPengTu edited a comment on issue #2405: [weex playground][Vue] iamge 【动态】设置宽高, 使用 animate 导致闪退问题
ZhiPengTu edited a comment on issue #2405: [weex playground][Vue] iamge 【动态】设置宽高, 使用 animate 导致闪退问题
URL: https://github.com/apache/incubator-weex/issues/2405#issuecomment-490375418
###问题代码 image 动态设置宽高时,在ios 端 出现闪退现象
``` javascript
<image class="godds-image" v-for="(item,index) in detailImageList" ref="img" @load="onImageLoad(index,$event)" :src="item" ></image>
```
``` javascript
onImageLoad (index,event) {
var that=this;
if (event.success) {
// Do something to hanlde success
const view = that.$refs['img'];
if (event.success){
if (Utils.env.isWeb()){
view[0].style.width= '10rem';
view[0].style.height= 10*event.size.naturalHeight/event.size.naturalWidth +'rem';
}else{
// modal.toast({
// message: '10rem',
// duration: 0.3
// })
animation.transition(view[0],{
styles:{
width: '750px',
height: `${750*event.size.naturalHeight/event.size.naturalWidth}px`
},
duration: 0,//需要设置为0,否则无效
timingFunction:'ease',
delay: 100,
needLayout:true,//变化后刷新界面
}, function(){
console.log(1)
})
}
}
}
},
```
> ### 开启 needLayout:true 直接闪退
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services