我如何在Vue文件中使用“ paper.on('cell:pointerdblclick',function(cellView){})”之类的方法?

时间:2019-08-12 09:58:02

标签: vue.js jointjs

我想使用jointjs来实现需求,如下所示: paper.on('cell:pointerdblclick', function(cellView) {})。凭什么,我该怎么办?

ReferenceError: cellView is not defined

<script>
    export default {
    mounted(){},
    methods: {
       registerDoubleClickEvent() 
          {this.paper.on('cell:pointerdblclick', 
           this.connectTwoObject(cellView))},
       connectTwoObject(cellView){alert('1234');},
     }}
</script>

谢谢!

1 个答案:

答案 0 :(得分:0)

从问题中我了解到,您想将callback的第一个参数传递给您的方法。似乎您的语法错误。您只是使用未定义的变量调用方法。要访问此变量,请尝试以下代码(箭头功能用于保存上下文)。另外,我相信您在#include <windows.h> #include <StdAfx.h> const char* myClassName="myWindowsClassName"; //The window procedure LRESULT CALLBACK WndProc( HWND hwnd , UINT msg , WPARAM wParam , LPARAM lParam){ switch(msg){ case WM_CLOSE: DestroyWindow( hwnd ); break; case WM_DESTROY: PostQuitMessage(0); break; default: return DefWindowProc( hwnd , msg , wParam , lParam ); } return 0; } //Registering window int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lPCmdLine , int nCmdShow ){ WNDCLASSEX wc; HWND hwnd; MSG msg; wc.cbSize=sizeof( WNDCLASSEX ); wc.style=0; wc.lpfnWndProc= WndProc; wc.cbClsExtra=0; wc.hInstance=hInstance; wc.hIcon=LoadIcon( NULL , IDI_APPLICATION); wc.hCursor=LoadCursor(NULL , IDC_ARROW); wc.hbrBackground= (HBRUSH)(COLOR_WINDOW+1); wc.lpszMenuName=NULL; wc.lpszClassName= (LPCWSTR) myClassName; wc.hIconSm=LoadIcon( NULL , IDI_APPLICATION ); if( !RegisterClassEx( &wc ) ){ MessageBox( NULL ,L"Window registeration failed" ,L"Error!" , MB_ICONEXCLAMATION | MB_OK ); return 0; } //Creating the window hwnd=CreateWindowEx( WS_EX_CLIENTEDGE , (LPCWSTR)myClassName , L"The title of my window" , WS_OVERLAPPEDWINDOW , CW_USEDEFAULT , CW_USEDEFAULT, 320 , 240 , NULL , NULL , hInstance , NULL ); hwnd=NULL; if( hwnd==NULL ){ MessageBox( NULL ,L"Window creation failed",L"Error!", MB_ICONEXCLAMATION | MB_OK ); return 0; } ShowWindow ( hwnd , nCmdShow ); UpdateWindow(hwnd); // Step 3: The Message Loop while(GetMessage(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } 中定义了connectTwoObject方法。

methods