0
我使用VueJS,我想将HTML-Canvas
与Canvas-Context
合并。我想打电话从context
内我components
像:VueJS + Canvas-Context如何链接在一起?
mounted() {
this.$c.moveTo(100, 100)
this.$c.lineTo(200, 200)
}
我在main.js
开始:
Vue.prototype.$c = document.querySelector('canvas').getContext('2d')
而且,我也不知道如何与关键字this
工作在构建这样的:
const Something = (x, y) => {
this.x = x
this.y = y
this.draw() {
this.$c.moveTo(100, 100)
this.$c.lineTo(200, 200)
}
}
所以,我怎么能结合canvas-context
和VueJS
?