"vue": "^2.4.4"
I defined properties in main.js:
Object.defineProperties(Vue.prototype, {
baseURL: {
value: process.env.API_ROOT,
writable: false
}
});
I have another js file named version.js in src/common
import Vue from "vue";
let app = new Vue({
el: "#app",
})
console.log("---------------------version start---------------------")
console.log("prototype 1:", Vue.prototype)
console.log("baseURL 1:", Vue.prototype.baseURL)
console.log("---------------------version end---------------------")
console.log("---------------------app start---------------------")
console.log("prototype 2:", app)
console.log("baseURL 2:", app.baseURL)
console.log("---------------------app end---------------------")
I can not understand the console log: prototype 1 contains the baseURL but baseURL 1 is undefined. prototype 2 didn't contains baseURL and baseURL 2 is undefined.
If I want to get the baseURL in version.js. what should I do?