I have a return value need to get from export const function store in abc.js, it reutrn the value I want successfully, but the problem is when I called this function in another side .vue, it becomes NaN here is code in js.
export let auto_quote_no_generator = () => {
let ans = "";
let first_half = "Q-CMS";
const q = firebase.firestore().collection('ALL_quote');
const snapshot = q.get(); //count is not a function
firebase.firestore().collection("ALL_quote").get().then(function(querySnapshot) {
console.log("auto_quote_no_generator1" +querySnapshot.size);
const docSize = parseFloat(querySnapshot.size);
console.log("auto_quote_no_generator2" +docSize);
let addedz = add_zero(docSize);
ans = first_half + addedz;
return ans; //<------- the value I want to return
});
}
in my vue file.
import { auto_quote_no_generator } from '../firebase';
...
let quote_number = auto_quote_no_generator();
console.log("check quote_num " + quote_number ); // it trun null
how can I show quote_number
successfully?