向您的Vue.js组件添加材料波纹

news/2024/7/5 0:59:02

Though it may appear that this week has been a fairly slow week for Vue.js news, at least one important, critical library has come into the light. That library is vue-ripple-directive! Once you’ve used it you’ll wonder how you ever lived without it. It provides your app with the ability to add Material Design Ripples to any component with a simple directive.

尽管对于Vue.js新闻来说,本周似乎是相当缓慢的一周,但至少有一个重要的关键库已经曝光。 该库是vue-ripple-directive ! 一旦使用了它,您会想知道没有它的生活。 它使您的应用程序能够通过简单的指令将Material Design Ripples添加到任何组件中

Ready to get started?

准备开始了吗?

安装 (Installation)

Install vue-ripple-directive via Yarn or NPM:

通过Yarn或NPM安装vue-ripple-directive :

# Yarn
$ yarn add vue-ripple-directive

# NPM
$ npm install vue-ripple-directive --save

Then register the directive:

然后注册指令:

main.js
main.js
import Vue from 'vue';
import Ripple from 'vue-ripple-directive';
import App from 'App.vue';

// Register the ripple directive.
Vue.directive('ripple', Ripple);

new Vue({
  el: '#app',
  render: h => h(App)
});

添加涟漪 (Adding Ripples)

You can now add ripples to any component using the v-ripple directive:

现在,您可以使用v-ripple指令将波纹添加到任何组件:

<button v-ripple>Button Example</button>

And customize the color:

并自定义颜色:

<button v-ripple="'rgba(200, 10, 10, 0.2)'">Creepy Red Button Example</button>

Change the transition speed:

更改过渡速度:

<button v-ripple.200>ReallyFastButtonExample</button>

Or even trigger it on mouseover!

甚至在鼠标悬停时触发它!

<button v-ripple.mouseover>C'mere mouse! (Example)</button>

翻译自: https://www.digitalocean.com/community/tutorials/vuejs-ripple-things


http://www.niftyadmin.cn/n/3648316.html

相关文章

职场笔记[0703]:置身事外

“普遍的高校水平仍与全球有较大差距。比如说在我们这个行业&#xff0c;我如果要招100个人&#xff0c;我会来中国&#xff1b;如果招1000个人&#xff0c;我也可以来中国&#xff0c;但有些勉强&#xff1b;但需要招1万人&#xff0c;我就要考虑去印度了&#xff1b;10万人&a…

使用React头盔管理您的头脑

React Helmet is a simple component that makes it easy to manage and dynamically set what’s in the document’s head section. For example, you can use React Helmet to set the title, description and meta tags for the document. React Helmet是一个简单的组件&am…

创业+社区点评:信息会过载吗?

看了创业社区之后第一句话就是“若邻的细分市场啊”。 “目前可能需要的是拥有下列资源的人”这个功能很实用&#xff0c;是若邻所没有的。对要关注的人提问的快速方式也很贴心。但是。。。现在用户少且精&#xff0c;容易组织起来。如果人数多了起来&#xff0c;不知道以现有的…

debian10 安装_如何在Debian 10上安装Jitsi Meet

debian10 安装The author selected the Open Internet/Free Speech Fund to receive a donation as part of the Write for DOnations program. 作者选择了“ 开放互联网/言论自由基金会”作为“ Write for DOnations”计划的一部分来接受捐赠。 介绍 (Introduction) Jitsi Me…

自然语言处理能够把全网内容组织到什么程度?

自然语言处理能够把全网内容组织到什么程度&#xff1f; Zhengyun 发表于创业社区 2007-03-27 23:23:40我的要求是不需要任何推动力&#xff0c;用户不需要做任何输入或搜索&#xff0c;社区内就已经围绕着细粒度的话题展开了。结果我们做到的自然语言处理后的主题收敛性很强&a…

resize_看看Resize Observer JavaScript API

resizeResize Observer is a new JavaScript API that’s very similar to other observer APIs like the Intersection Observer API. It allows for elements to be notified when their size changes. Resize Observer是一个新JavaScript API&#xff0c;与诸如Intersection…

新闻聚合引擎能把新闻组织到什么程度? 兼谈百度google新闻

zhengyun_ustc 2007-3-31书接上回《自然语言处理能够把全网内容组织到什么程度&#xff1f;》。百度新闻和google新闻都是不错的新闻聚合&#xff0c;内容组织得不错。那么我们的机会又在哪里呢&#xff1f;我们怎么才能提供一个新闻事件脉络呢&#xff1f;后面我会讲到百度和g…

javascript控制台_看一下JavaScript控制台API

javascript控制台The JavaScript console is an invaluable tool to help develop and debug our apps. With the console object and its logging methods, long are the days of of calling alert() to debug and get a variable’s value. On top of that, thanks to a work…