这篇文章主要介绍微信小程序开发中会遇到的问题有哪些,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!
data数据更新
this.data.key = value
this.setData({
key: value
})
require
const util = require('../../utils/util.js')
background-image
不能使用静态文件,只能使用base64和网络图片
可以用<img>解决
background: #fff url(data:image/jpeg;base64,***)
<image class="logo" src="/images/logo.png" mode="cover"></image>
组件样式
app.wxss 的样式不能应用到组件内部
可以按需引用 import: “”
@import "/app.wxss";
textarea
事件传参
<view id="tapTest" data-hi="WeChat" bindtap="tapName"> Click me! </view>
Page({
tapName(event) {
console.log(event.currentTarget.dataset.hi)
}
})
animation
animation不能直接绑定中组件上
外面包裹一层<view>
<view animation={{animation}}>
<my-component></my-component>
</view>
checkBox
<checkbox-group bindchange="checkboxChange">
<view bindtap="bindTap">
<view catchtap='catchTap'">
<checkbox value="{{value}}" checked="{{checked}}"/>
</view>
</view>
</checkbox-group>
以上是“微信小程序开发中会遇到的问题有哪些”这篇文章的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注天达云行业资讯频道!