ng2-canvas-whiteboard在Angular7.3.5中不起作用

时间:2019-04-18 11:30:01

标签: html5-canvas angular7 whiteboard

我按照安装ng2-canvas-whiteboard软件包的说明进行操作,但是页面空白。 这是我所做的:

输入模块:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

在组件中:

import { CanvasWhiteboardModule } from 'ng2-canvas-whiteboard';

@NgModule({
    imports: [
        CanvasWhiteboardModule,
]

在HTML中:

import { CanvasWhiteboardComponent, CanvasWhiteboardOptions, CanvasWhiteboardUpdate } from 'ng2-canvas-whiteboard';


 viewProviders: [CanvasWhiteboardComponent],
@ViewChild('canvasWhiteboard') canvasWhiteboard: CanvasWhiteboardComponent;

public canvasOptions: CanvasWhiteboardOptions;

ngOnInit() {
            this.canvasOptions = {
                drawButtonEnabled: true,
                drawButtonClass: "drawButtonClass",
                drawButtonText: "Draw",
                clearButtonEnabled: true,
                clearButtonClass: "clearButtonClass",
                clearButtonText: "Clear",
                undoButtonText: "Undo",
                undoButtonEnabled: true,
                redoButtonText: "Redo",
                redoButtonEnabled: true,
                colorPickerEnabled: true,
                saveDataButtonEnabled: true,
                saveDataButtonText: "Save",
                lineWidth: 5,
                strokeColor: "rgb(0,0,0)",
                shouldDownloadDrawing: true
              };
        }
  sendBatchUpdate(updates: CanvasWhiteboardUpdate[]) {
    console.log(updates);
  }
  onCanvasClear() {
    console.log("The canvas was cleared");
  }
  onCanvasUndo(updateUUID: string) {
    console.log(`UNDO with uuid: ${updateUUID}`);
  }
  onCanvasRedo(updateUUID: string) {
    console.log(`REDO with uuid: ${updateUUID}`);
  }

1 个答案:

答案 0 :(得分:0)

在添加模块代码之前,我一直遇到相同的问题     `从“ ng2-canvas-whiteboard”导入{CanvasWhiteboardModule};

 @NgModule({
     imports: [
         CanvasWhiteboardModule,
 ]`

到SPECIFIC页面的模块文件-不仅在app.module.ts文件中。

I.E。它也必须在your-page-name.module.ts