0

My component vue is like this :

<script>
    export default {
        ...
        methods: {
            deleteImageProduct(event) {
                const payload = {id: this.productId}
                const data = this.$store.dispatch('deleteProduct', payload);
                data.then((res) => 
                    $('#test').remove();
                )
            }
        } 
    }
</script>

When executed, on the gulp watch exist error :

Module build failed: SyntaxError: Unexpected token

And on the console exist error :

Uncaught ReferenceError: jQuery is not defined

I use jquery because the called div is in view or not located in the vue component

How can I solve this problem?

1 Answer 1

0

You should import jquery library so that you can use it.

import $ from 'jquery'

More info here: https://www.npmjs.com/package/jquery

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.