Repository: DevExpress/devextreme-vue (ts)

Issue:
dxDataGrid: Uncaught TypeError: Cannot read property 'beforeDestroy' of undefined
### Issue Type

[x] 'bug report'

### Description

#### Current Behavior

If you start up the examples (npm run serve), ungroup the region column in the dxDataGrid Example you'll get the following javascript error:

Uncaught TypeError: Cannot read property 'beforeDestroy' of undefined
    at callHook (vue.esm.js:2917)
    at HTMLDivElement.Vue.$destroy (vue.esm.js:2700)
    at HTMLDivElement.oneTimeHandler (events_engine.js:372)
    at callHandler (events_engine.js:117)
    at Object.wrappedHandler (events_engine.js:140)
    at handleCallback (events_engine.js:211)
    at Array.forEach (<anonymous>)
    at Object.callHandlers (events_engine.js:215)
    at events_engine.js:413
    at Object.<anonymous> (events_engine.js:281)

#### Expected Behavior

No error

### Steps to Reproduce

- npm run serve
- navigate to dxDataGrid example
- ungroup column region

(or click on page 2 - same error)

### Environment Details

- master as of 036025c9aa5129c34cc4f446bdbc89d8e6a34ede
- chrome 65.0.3325.181


Pull request:
Fix template vue instance disposing
Fixes #53.

Patch:
diff --git a/src/core/component.ts b/src/core/component.ts
index b32b018..cc9822c 100644
--- a/src/core/component.ts
+++ b/src/core/component.ts
@@ -67,7 +67,7 @@ const DxComponent: VueConstructor = Vue.extend({
                     const container = data.container.get ? data.container.get(0) : data.container;
                     container.appendChild(element);
 
-                    events.one(element, DX_REMOVE_EVENT, vm.$destroy);
+                    events.one(element, DX_REMOVE_EVENT, vm.$destroy.bind(vm));
 
                     return element;
                 }


Test patch:
diff --git a/src/core/component.test.ts b/src/core/component.test.ts
index cd14f7f..e61d4ef 100644
--- a/src/core/component.test.ts
+++ b/src/core/component.test.ts
@@ -180,6 +180,21 @@ describe("template", () => {
         expect(renderedTemplate.attributes).toHaveProperty("custom-attr");
         expect(renderedTemplate.attributes["custom-attr"].value).toBe("123");
     });
+
+    it("doesn't throw on dxremove", () => {
+        new Vue({
+            template: `<test-component>
+                            <div slot='item' slot-scope='props'>Template {{props.text}}</div>
+                        </test-component>`,
+            components: {
+                TestComponent
+            }
+        }).$mount();
+
+        const renderedTemplate = renderItemTemplate({ text: "with data" });
+
+        expect(() => events.triggerHandler(renderedTemplate, "dxremove")).not.toThrow();
+    });
 });
 
 describe("events emitting", () => {