How to create Constants in Vue js.

devquora
devquora

Posted On: Nov 17, 2022

 

To create constant const keyword is used. In Vue.js we suggest creating a separate file for defining your constants.
Example:

Creating a Constant in Vue js.

export const SITE_URL = 'https://www.onlineinterviewquestions.com';

Importing a Constant in Vue js.

import {SITE_URL} from './path/to/constants.js';

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Vue.js Interview Questions

    What is Vue.js?

    Vue js is progressive javascript script used to create dynamic user interfaces.Vue js is very easy to learn.In order to..

    Vue.js Interview Questions

    List some features of Vue.js.

    Vue js comes with following features Templates Reactivity Components Transitions Routing ..

    Vue.js Interview Questions

    Explain Life cycle of Vue Instance.

    The Life cycle of each Vue instance goes through a series of initialization steps when it is created. – for example, ..