2.0.0 • Published 11 months ago

overlay_addtocart v2.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

Overlay Add to cart

Description

Add to cart effect to use in order shop vue application

Install

#npm
npm i overlay_addtocart

Import in Vue

import Vue from "vue";
import App from "./App.vue";
import overlay from "overlay_addtocart";

Vue.use(overlay);

new Vue({
  render: (h) => h(App),
}).$mount("#app");

Using

<template>
  <div>
    <button @click="test">a</button>
    <div ref="start" class="start"></div>
    <div ref="end" class="end"></div>
  </div>
</template>

<script>
import ItemCompo from '@/components/ItemCompo'
export default {
  methods: {
    test() {
      this.$overlay({
        from: ".start",
        to: ".end",
        duration: 2000, // ms
        startScale: 0.9,
        startOpacity: 0.9,
        endScale: 0.1,
        endOpacity: 0.1,
        render: this.$createElement(ItemCompo)  // >> VNode
        done: () => {
          alert("done");
        },
      });
    },
  },
};
</script>

without using query selector

...
        from: this.$refs.start,
        to: this.$refs.end,
...

Options

OptionsAcceptDefaultNote
fromstring(query selector), VDOM, DOMbodycontainer where start effect
tostring(query selector), VDOM, DOMbodycontainer where end effect
durationnumber (ms)1000time effect
startScalenumber1item scale at the start effect
startOpacitynumber1item opacity at the start effect
endScalenumber0item scale at the end effect
endOpacitynumber0item opacity at the end effect
renderVNodenullcomponent will render in slot default
donefunctionnullfunction active when after effect

phamthao2001

2.0.0

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago