Giter Club home page Giter Club logo

Comments (8)

qiu8310 avatar qiu8310 commented on May 27, 2024

没明白,能具体点吗?canvasContext 我记得有一个专门的 class 的

from minapp.

fengcen avatar fengcen commented on May 27, 2024

我有一个class:

import { CanvasContext } from '@minapp/core';  // 这行代码报错,提示“没有导出的成员 CanvasContext”

class Canvas {
  ctx: CanvasContext;  // 想使用这个类作为 ctx 的类型,否则用 any 的话没有智能提示

  constructor(canvasId: string, instance: any) {
    this.ctx = wx.createCanvasContext(canvasId, instance);
  }

  add(image: Image) {
    this.ctx.drawImage(image.url, image.x, image.y, image.width, image.height); 
    this.ctx.draw();
  }
}

from minapp.

qiu8310 avatar qiu8310 commented on May 27, 2024

哦,这个已经有了,全在 wx 这个命名空间里,比如 wx.CanvasContext

其实,所有的 interface 你都能在 wx 中找到,比如 request 函数参数是 wx.request.Param 类似,总之 request 函数的所有相关 interface 都在 wx.request. 中

from minapp.

qiu8310 avatar qiu8310 commented on May 27, 2024

其它情况都类似,你自己去体验一下,很容易找到我的命名规律的

wxp 中也类似

from minapp.

fengcen avatar fengcen commented on May 27, 2024

谢谢,找了一下没找到 o(╯□╰)o

from minapp.

qiu8310 avatar qiu8310 commented on May 27, 2024

@fengcen 这个我确定有的,我这几天不方便用电脑。 你可以在这文件里找找 https://github.com/qiu8310/minapp/blob/master/packages/minapp-core/typing/wx.d.ts

from minapp.

fengcen avatar fengcen commented on May 27, 2024

找到了,刚才说的是之前没找到,囧

from minapp.

qiu8310 avatar qiu8310 commented on May 27, 2024

好吧,我理解错了 😀

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.