Skip to content

Instantly share code, notes, and snippets.

@teimur8
Created April 9, 2020 03:55
Show Gist options
  • Save teimur8/9157f52adb4512493ce9d27f478a269d to your computer and use it in GitHub Desktop.
Save teimur8/9157f52adb4512493ce9d27f478a269d to your computer and use it in GitHub Desktop.
// vue ingect
export function injectFavorites(): void {
const els: NodeListOf<Element> = document.querySelectorAll('.product-card__favorite-section');
if (els) {
/* tslint:disable */
for (const i in els) {
const el: Element = els[i];
if (el && el instanceof HTMLElement) {
el.innerHTML = '';
new AddToFavorites({
store,
propsData: {
externalId: (el.getAttribute('id') as string).replace('external_id_', ''),
viewPlace: (el.getAttribute('data-view-place')),
},
}).$mount(`#${el.getAttribute('id')}`);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment