大神求教,canvas每次输入刷新都没有图片
发布于 6 年前 作者 lchang 18859 次浏览 来自 问答

我写了一个canvas,插入一张图片,和一段文字,文字可以跟输入表单的内容变化的,但是当输入内容时,上面的字有变化,可是图片变刷新没有了,怎么办?

写上字后

为什么图片会不见了呢?

6 回复

你好,请提供一下能复现问题的简单代码示例。

这个mpmb,调用的跟上面绘图的代码一样内容

可以将代码拷贝上来么?不要截代码的图。

//输入框输入显示

searchInputEvent: function (e) {

console.log(e.currentTarget.id)

if (e.currentTarget.id == “name”) {

this.setData({ name: e.detail.value })

} else if (e.currentTarget.id == “company”) {

this.setData({ company: e.detail.value })

} else if (e.currentTarget.id == “carrer”) {

this.setData({ carrer: e.detail.value })

} else if (e.currentTarget.id == “address”) {

this.setData({ address: e.detail.value })

} else if (e.currentTarget.id == “tel”) {

this.setData({ tel: e.detail.value })

} else if (e.currentTarget.id == “call”) {

this.setData({ call: e.detail.value })

} else if (e.currentTarget.id == “email”) {

this.setData({ email: e.detail.value })

} else if (e.currentTarget.id == “internet”) {

this.setData({ internet: e.detail.value })

}

// console.log(1);

this.mpmb();

},

额,我主要是要mpmb的实现……

我这么写好像是错的,因为每次写字都会重新渲染一次页面。。。

回到顶部