貌似ShopifyApp.flashError使得以postMessage的一个电话:
e.postMessage = function(e, t) {
var r;
return null == t && (t = {}), r = JSON.stringify({
message: e,
data: t
}),
n("client sent " + r + " to " + this.shopOrigin),
window.parent.postMessage(r, this.shopOrigin),
null != t ? t.callbackId : void 0
}, e.flashNotice = function(e) {
return this.postMessage("Shopify.API.flash.notice", {
message: e
})
}, e.flashError = function(e) {
return this.postMessage("Shopify.API.flash.error", {
message: e
})
}
所以,如果你能找到被监听发送到“Shopify.API.flash.error”消息逻辑位即可找到呈现消息的代码。然而,考虑到r = JSON.stringify({ message: e, data: t})
的调用,我怀疑你是运气不足,因为传递足够特殊的字符来调用换行符。
你有没有偷看到'flashError'方法的源代码?答案可能在那里。 – Forty3
感谢您的建议@ Forty3。但我相信我们无法访问Shopify源代码! – zahra