Skip to content

小程序 改写 setData  #39

Description

@shaobeichen
const originComponent = Component
Component = function (options) {
  const optionsAttached = options.attached
  if (optionsAttached) {
    options.attached = function (...args) {
      const setDataRaw = this.setData
      this.setData = function (...args) {
        console.log('当次setData数据', args)
        setDataRaw.apply(this, args)
      }
      optionsAttached.apply(this, ...args)
    }
  }
  return originComponent(options)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions