最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Xx-vue自定義指令實(shí)現(xiàn)點(diǎn)擊水波紋漣漪效果

 更新時(shí)間:2023年07月05日 10:34:21   作者:風(fēng)中凌亂的男子  
這篇文章主要為大家介紹了Xx-vue自定義指令實(shí)現(xiàn)點(diǎn)擊水波紋漣漪效果,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪

目錄概覽:

|____
|____directive
| |____waves.css
| |____waves.js
|____main.js

waves.css

.waves-ripple {
    position: absolute;
    border-radius: 100%;
    background-image: radial-gradient(circle, rgba(255, 255, 255, .35) 100%, rgba(0, 0, 0, .15) 100%);
    background-clip: padding-box;
    pointer-events: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-transform: scale(0);
    -ms-transform: scale(0);
    transform: scale(0);
    opacity: 1;
}
.waves-ripple.z-active {
    opacity: 0;
    -webkit-transform: scale(2);
    -ms-transform: scale(2);
    transform: scale(2);
    -webkit-transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
    transition: opacity 1.2s ease-out, -webkit-transform 0.6s ease-out;
    transition: opacity 1.2s ease-out, transform 0.6s ease-out;
    transition: opacity 1.2s ease-out, transform 0.6s ease-out, -webkit-transform 0.6s ease-out;
}

waves.js

import './waves.css';
const vueWaves = {};
vueWaves.install = (Vue, options = {}) => {
  Vue.directive('waves', {
    bind(el, binding) {
      el.addEventListener('click', e => {
        const customOpts = Object.assign(options, binding.value);
        const opts = Object.assign({
            ele: el, // 波紋作用元素
            type: 'hit', // hit點(diǎn)擊位置擴(kuò)散center中心點(diǎn)擴(kuò)展
            color: 'rgba(0, 0, 0, 0.15)' // 波紋顏色
          }, customOpts),
          target = opts.ele;
        if (target) {
          target.style.position = 'relative';
          target.style.overflow = 'hidden';
          const rect = target.getBoundingClientRect();
          let ripple = target.querySelector('.waves-ripple');
          if (!ripple) {
            ripple = document.createElement('span');
            ripple.className = 'waves-ripple';
            ripple.style.height = ripple.style.width = Math.max(rect.width, rect.height) + 'px';
            target.appendChild(ripple);
          } else {
            ripple.className = 'waves-ripple';
          }
          switch (opts.type) {
            case 'center':
              ripple.style.top = (rect.height / 2 - ripple.offsetHeight / 2) + 'px';
              ripple.style.left = (rect.width / 2 - ripple.offsetWidth / 2) + 'px';
              break;
            default:
              ripple.style.top = (e.pageY - rect.top - ripple.offsetHeight / 2 - document.body.scrollTop) + 'px';
              ripple.style.left = (e.pageX - rect.left - ripple.offsetWidth / 2 - document.body.scrollLeft) + 'px';
          }
          ripple.style.backgroundColor = opts.color;
          ripple.className = 'waves-ripple z-active';
          return false;
        }
      }, false);
    }
  })
};
export default vueWaves;

main.js

import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import vueWaves from './directive/waves'
Vue.use(vueWaves)
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>',
})

使用示例:

v-waves
<a class='header__crumbs--btn' @click.stop='goback' v-waves>返回</a>

以上就是Xx-vue自定義指令實(shí)現(xiàn)點(diǎn)擊水波紋漣漪效果的詳細(xì)內(nèi)容,更多關(guān)于Xx-vue點(diǎn)擊水波紋漣漪的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Vue3中如何使用component :is 加載組件

    Vue3中如何使用component :is 加載組件

    Monaco-editor,一個(gè)vs code 編輯器,需要將其集成到項(xiàng)目,這篇文章主要介紹了Vue3中如何使用component :is 加載組件,需要的朋友可以參考下
    2023-11-11
  • element多個(gè)表單校驗(yàn)的實(shí)現(xiàn)

    element多個(gè)表單校驗(yàn)的實(shí)現(xiàn)

    在項(xiàng)目中,經(jīng)常會(huì)遇到表單檢驗(yàn),在這里我分享在實(shí)際項(xiàng)目中遇到多個(gè)表單同時(shí)進(jìn)行校驗(yàn)以及我的解決方法,感興趣的可以了解一下
    2021-05-05
  • Vue 3 的<Teleport>功能與用法詳解

    Vue 3 的<Teleport>功能與用法詳解

    <Teleport> 是 Vue 3 的一個(gè)內(nèi)置組件,允許將組件的內(nèi)容渲染到 DOM 中的任意位置,而不改變其邏輯結(jié)構(gòu),這篇文章主要介紹了Vue 3 的<Teleport>功能與用法詳解,需要的朋友可以參考下
    2025-04-04
  • vue3上傳文件、圖片、視頻組件實(shí)例代碼

    vue3上傳文件、圖片、視頻組件實(shí)例代碼

    文件上傳是一個(gè)老生常談的話題了,這篇文章主要介紹了vue3上傳文件、圖片、視頻組件的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2026-05-05
  • Vue3中導(dǎo)入和使用圖標(biāo)庫Font Awesome的實(shí)現(xiàn)步驟

    Vue3中導(dǎo)入和使用圖標(biāo)庫Font Awesome的實(shí)現(xiàn)步驟

    Font Awesome 是互聯(lián)網(wǎng)的圖標(biāo)庫和工具包,被數(shù)百萬設(shè)計(jì)師、開發(fā)人員和內(nèi)容創(chuàng)建者使用,Font Awesome的圖標(biāo)非常豐富,基本涵蓋你所需要的所有,本文給大家介紹了Vue3中導(dǎo)入和使用圖標(biāo)庫Font Awesome的具體步驟,需要的朋友可以參考下
    2025-01-01
  • 使用vue.js在頁面內(nèi)組件監(jiān)聽scroll事件的方法

    使用vue.js在頁面內(nèi)組件監(jiān)聽scroll事件的方法

    今天小編就為大家分享一篇使用vue.js在頁面內(nèi)組件監(jiān)聽scroll事件的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-09-09
  • VUE對(duì)接deepseekAPI調(diào)用方式

    VUE對(duì)接deepseekAPI調(diào)用方式

    文章介紹了如何在Vue項(xiàng)目中對(duì)接DeepSeek API,包括在開放平臺(tái)注冊(cè)賬號(hào)申請(qǐng)APIKey、安裝axios庫、創(chuàng)建API調(diào)用函數(shù)以及在Vue組件中調(diào)用該函數(shù)
    2025-01-01
  • vue豎向步驟條方式

    vue豎向步驟條方式

    這篇文章主要介紹了vue豎向步驟條方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,
    2023-12-12
  • 通過Vue+axios獲取接口數(shù)據(jù)的示例詳解

    通過Vue+axios獲取接口數(shù)據(jù)的示例詳解

    這篇文章主要介紹了Vue結(jié)合axios獲取笑話接口數(shù)據(jù)的示例,重點(diǎn)講解axios的特性、使用方法及請(qǐng)求方式,演示如何通過get方法獲取數(shù)據(jù)并展示,同時(shí)解決this指向問題,感興趣的小伙伴跟著小編一起來看看吧
    2025-08-08
  • 使用vue導(dǎo)出excel遇到的坑及解決

    使用vue導(dǎo)出excel遇到的坑及解決

    這篇文章主要介紹了使用vue導(dǎo)出excel遇到的坑及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2022-04-04

最新評(píng)論

辽阳县| 昌图县| 运城市| 滦南县| 化州市| 和平区| 西丰县| 乾安县| 无棣县| 罗源县| 宣恩县| 绵阳市| 东源县| 祁东县| 柘城县| 溆浦县| 珠海市| 霍山县| 永济市| 凤台县| 绩溪县| 鄂伦春自治旗| 沅陵县| 濉溪县| 神池县| 白河县| 凤庆县| 常宁市| 维西| 比如县| 十堰市| 治多县| 台东县| 辉县市| 鹿泉市| 隆子县| 崇礼县| 万州区| 安达市| 辉县市| 紫阳县|