一些需要注意的细节:
usingComponents
字段)。
注意,是否在页面文件中使用 usingComponents
会使得页面的 this
对象的原型稍有差异,包括:
usingComponents
页面的原型与不使用时不一致,即 Object.getPrototypeOf(this)
结果不同。usingComponents
时会多一些方法,如 selectComponent
。usingComponents
时, setData
内容不会被直接深复制,即 this.setData({ field: obj })
后 this.data.field === obj
。(深复制会在这个值被组件间传递时发生。)
如果页面比较复杂,新增或删除 usingComponents
定义段时建议重新测试一下。