我從函數接收一個值以傳遞給類中的方法。當我傳遞從 web.js 中的函數返回的值時,它在我的shopifyStore類中返回未定義??赡苁鞘裁丛蛞约拔以撊绾谓鉀Q這個問題?PS:JavaScript初學者網頁.jswindow.shopify.findName({}, function(items) { var shopify = items; console.log(items); //this returns the value pushValue(items); });export function pushValue(items) { return items; }成分import * as shopifyHelper from '/web.js';class shopifyStore extends HTMLElement { constructor() { super(); } getItemCount() { console.log(shopifyHelper.pushValue()) // this returns undefined }}
返回未定義的值 - Javascript
汪汪一只貓
2023-07-29 16:08:42