1. props传值变量名不要使用id
页面:
<scrollView :dataInfo.sync='questions' myId='333' id='444'>
scrollView组件:
created() {
console.log(this.myId)
console.log(this.id)
}
输出结果:
2.组件没有页面事件
也就没有onload等事件,只支持vue原生事件
那么created、mounted与onload 的先后顺序是怎么样的呢
参考uni-app官网文档:https://uniapp.dcloud.io/collocation/frame/lifetime
参考vue官方文档:https://cn.vuejs.org/v2/guide/instance.html
created 是在模板渲染前,也就是在onload之前。
mounted是在模板渲染之后,onload是在页面渲染之后,那么具体哪个先呢。测试结果如下