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.

Revisions

  1. teimur8 created this gist Apr 9, 2020.
    23 changes: 23 additions & 0 deletions vue.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    // 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')}`);
    }
    }
    }
    }