2017-04-05 8 views
0

Shopifyは小さな赤い浮動モーダル上のエラーを示すために、そのEmbedded App SDKに非常に有用methodがあります:ShopifyApp.flashError("Your error");どのように私は(ShopifyApp.flashErrorで複数行のエラーを持つことができます)

私の問題は、私はそれに複数行のエラーを持つことができないということです。私はnewlineを持っているため\n/n/r\r<br />およびを試しました。何も働かなかった!何か案は?

+0

'flashError'メソッドのソースコードを覗いてみましたか?答えはそこにあるかもしれません。 – Forty3

+0

あなたの提案@ Forty3に感謝します。しかし私は、Shopifyのソースコードにアクセスできないと信じています! – zahra

答えて

1

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})の呼び出しでは、改行を呼び出すのに十分な特殊文字を渡す限り、あなたは運がないと思われます。

関連する問題