Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

小程序 改写 setData #39

Open
shaobeichen opened this issue Dec 19, 2022 · 0 comments
Open

小程序 改写 setData #39

shaobeichen opened this issue Dec 19, 2022 · 0 comments

Comments

@shaobeichen
Copy link
Owner

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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant