Giter Club home page Giter Club logo

Comments (6)

zaaack avatar zaaack commented on May 27, 2024 2

好吧,其实是我写的tsx编译脚本有问题。。 🤦‍♂️

from minapp.

zaaack avatar zaaack commented on May 27, 2024

MyComponent.ts

init() {// 实际调用
   console.log('super init')
   return elmLikeBase.init.call(this)
}
onAttached() {
    console.log('this', this)
    console.log('this.methods', this.methods)
    console.log('attached', this.init)
    let res = this.init()
    const setState = (data: Partial<D>) => {
      if (data) {
        this.setState(data)
      }
    }
    if (res instanceof Promise) {
      return res.then(setState)
    } else {
      return setState(res)
    }
  }

articles.ts (继承自 MyComponent.ts)

  init() {// 预期调用
    this.api = Loadable.api(loadableApis, this)
    Utils.debug('articles init')
  }

from minapp.

zaaack avatar zaaack commented on May 27, 2024

好吧,目测是因为 init 方法被编译到 methods 里去了的缘故。。

from minapp.

zaaack avatar zaaack commented on May 27, 2024

https://github.com/qiu8310/minapp/blob/master/packages/minapp-core/src/system/module/BaseComponent.ts#L136

这一行可否添加配置排除某些方法自动加入到 methods?

from minapp.

qiu8310 avatar qiu8310 commented on May 27, 2024

我有时间也研究下你的 tsx,也许可以开个小版本

from minapp.

zaaack avatar zaaack commented on May 27, 2024

@qiu8310 现在 tsx 这个脚本越来越复杂了,为了处理很多 edge case 已经变得越来越乱了。。

from minapp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.