Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

debiprasad's avatar

How to use Base Spark Components in Custom Vue Components?

Here is the code of my Custom Vue Component.

var base = require('settings/subscription/subscribe-braintree');

Vue.component('subscribe', {
    mixins: [base],

    /**
     * The component's data.
     */
    data() {
        return {
            plan: ''
        }
    }
});

I am using a Base Spark Component. But I am getting some error with a component used in the mixin of the base spark component. Where am I doing it wrong?

Here is the code of settings/subscription/subscribe-braintree

...

    mixins: [
        require('./../../mixins/braintree'),
        require('./../../mixins/plans'),
        require('./../../mixins/subscriptions')
    ],

...

        this.braintree('braintree-subscribe-container', response => {
            this.form.braintree_type = response.type;
            this.form.braintree_token = response.nonce;

            this.subscribe();
        });

...

I am getting the following error:

[Vue warn]: Error in mounted hook: "ReferenceError: braintree is not defined"

0 likes
0 replies

Please or to participate in this conversation.