0
正方形の支払いフォームのWebコンポーネントを作成しようとしていますが、影DOMに読み込むのが問題です。正方形の支払いフォームを影DOMに読み込む方法
フォームがSquare CDNのスクリプトで設定されているので、これが可能かどうかは疑問です。
誰もこのユースケースで運があったのですか?
https://docs.connect.squareup.com/articles/adding-payment-form の例のコードを使用して、それをWebコンポーネントテンプレートに挿入しています。
完全なコード例はCodepenにあります。
https://codepen.io/kvnapavl/pen/BRQZrx?editors=1000#0
<base href="https://cdn.rawgit.com/download/polymer-cdn/1.5.0/lib/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<script type="text/javascript" src="https://js.squareup.com/v2/paymentform"></script>
<dom-module id="square-payment-form">
<template>
// Square payment form code from https://docs.connect.squareup.com/articles/adding-payment-form
</template>
<script>
Polymer({
is: 'square-payment-form'
});
</script>
</dom-module>
Polymer Starter KitなどのプログレッシブWebアプリケーションを作成する場合は、別の支払いプロバイダを使用する必要がありますか? – KVNA
あなたは何を意味するのか分かりません。 AFAIKシャドウDOMを使用するアプリケーションシェルに要素が含まれている場合、その要素は明るいとみなされます。 https://www.polymer-project.org/1.0/docs/devguide/local-dom – KVNA
申し訳ありませんが、私はあなたがコンポーネント内から電子商取引フォームを使用することができないことを意味します(javascriptライブラリは、 iframeを作成するためにコンポーネントのシャドーDOMに移動します)。 Polymer Starter Kitでは、電子商取引のフォームをindex.htmlの「」の外側に貼り付けることができます。 –
tristansokol