You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
641 B

import Konva from "konva";
const container=function (width=0,height=0,container){
const stage = new Konva.Stage({
container: container,
width: width,
height: height,
});
const layer = new Konva.Layer();
stage.add(layer)
layer.draw();
const imageObj = new Image();
const imgSize=width
imageObj.src = require('@/assets/kban/bg.png');
imageObj.onload = function () {
const shape = new Konva.Image({
x: 0,
y: 0,
width: imgSize,
height:this.height,
image: imageObj,
});
layer.add(shape)
shape.zIndex(0)
}
return {
stage,layer
}
}
export default container