How to Load Square Payment Form in Shadow DOM

隐身守侯 提交于 2019-12-12 04:31:31

问题


I am trying to create a Web Component for the Square Payment form, but am having trouble getting it to load into the shadow DOM.

I am wondering whether or not this is possible, since the form is populated with a script from the Square CDN.

Has anyone had any luck with this use case?

I am using code from an example on https://docs.connect.squareup.com/articles/adding-payment-form and inserting it into a Web Component template.

The full code example is on 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>

回答1:


At this time you won't be able to use the Square e-commerce form inside the shadow dom. I'd recommend keeping it in the light 🙂.



来源:https://stackoverflow.com/questions/43620053/how-to-load-square-payment-form-in-shadow-dom

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!