use web component to share function in React and Vue
must register first by customElements
.
global.customElements.define('share-component', ShareComponent)
<share-component sku="8477015" />
In React, self defined component is capitalized, so lower case tag name could be use directly as raw element.
<share-component sku="8477015" />
must tell vue this element tag is already defined
Vue.config.ignoreElements = ['share-component']
then in .vue
file template
<share-component sku="8477015" />
Can NOT be used in IE AND EDGE.
yarn
yarn start