Skip to content

beforeDestroy not invoked #87

@fpoliquin

Description

@fpoliquin

Hi,

I just created a sample Vue/Typescript app using Toilal/vue-webpack-template. Everything is working great (compilation, lint, hot reload, etc.).

I defined a small popup component to test different features and I've hit a problem with the beforeDestroy hook. It does not get invoked.

Here is my code:

import Vue from 'vue'
import Component from 'vue-class-component'
import WithRender from './Popup.html?style=./Popup.css'

@WithRender
@Component
export default class Popup extends Vue {

    ...

    mounted() {
        console.info('mounted')
        window.addEventListener('keyup', this.onKeyup)
    }

    beforeDestroy() {
        console.info('beforeDestroy')
        window.removeEventListener('keyup', this.onKeyup)
    }
}

The mounted hook is getting invoked. I've tried the same approach with the standard webpack template and it worked.

I'm using the latest versions :
"vue": "^2.2.6",
"vue-class-component": "^5.0.1",
"vue-router": "^2.4.0"

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions