vue 页面过渡动画翻转_具有良好过渡效果的翻转元素的组件

vue 页面过渡动画翻转

老虎夹 (vue-flipper)

A component to flip elements with a nice transition.

一个具有良好过渡的翻转元素的组件。

vue-flipper

  • :zap: It is really small, JavaScript + CSS (min + gzip) is smaller than 1KB

    :zap:确实很小,JavaScript + CSS(最小+ gzip)小于1KB

  • :art: CSS uses Stylus + BEM + Autoprefixer

    :art:CSS使用Stylus + BEM + Autoprefixer

  • :package: There are ESM, CommonJS and UMD distributions

    :package:有ESM,CommonJS和UMD发行版

You can se by youself on Codepen or CodeSandbox.

您可以在CodepenCodeSandbox自行 设置

安装 (Installation)

This library is published in the NPM registry and can be installed using any compatible package manager.

该库在NPM注册表中发布,可以使用任何兼容的程序包管理器进行安装。

npm install vue-flipper --save

# For Yarn, use the command below.
yarn add vue-flipper

用法 (Usage)

Just import Flipper component from 'vue-flipper' and use it like any other Vue component.

只需从'vue-flipper'导入Flipper组件,然后像使用任何其他Vue组件一样使用它即可。

<template>
  <flipper
    width="270px"
    height="300px"
    :flipped="flipped"
    @click="onClick"
  >
    <div slot="front">Frontface</div>

    <div slot="back">Backface</div>
  </flipper>
</template>

<script>
import Flipper from 'vue-flipper';

export default {
  components: { Flipper },
  data () {
    return {
      flipped: false
    };
  },
  methods: {
    onClick () {
      this.flipped = !this.flipped;
    }
  }
};
</script>

<style src="vue-flipper/dist/vue-flipper.css" />

用作全局组件 (Usage as global component)

If you need <flipper /> available everywhere, you can register it as a global component.

如果需要随处可用的<flipper /> ,则可以将其注册为全局组件。

And don't forget to import its CSS.

并且不要忘记导入其CSS。

import 'vue-flipper/dist/vue-flipper.css';
import Vue from 'vue';
import Flipper from 'vue-flipper';

Vue.component('flipper', Flipper);

CDN的用法 (Usage from CDN)

vue-flipper has an UMD bundle and CSS available through JSDelivr and Unpkg CDNs.

vue-flipper具有UMD捆绑包和CSS,可通过JSDelivr和Unpkg CDN使用。

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vue-flipper/dist/vue-flipper.css" />

<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-flipper"></script>

<script>
  /**
   * vue-flipper is available through VueFlipper.
   */
  console.dir(VueFlipper);

  /**
   * Vue.use will add flipper as global component.
   */
  Vue.component('flipper', VueFlipper);
</script>

道具 (Props)

NameDescriptionTypeDefault
flippedIf true flips to backface, otherwise to frontface.Booleanfalse
widthComponent's width.CSSLength (String)'100%'
heightComponent's height.CSSLength (String)'100%'
durationComponent's transition duration.CSSTime (String)'0.5s'
transitionComponent's transition timing function.CSSTransitionFunction (String)'ease-in'
名称 描述 类型 默认
翻转 如果为true翻转为背面,否则翻转为正面。 Boolean false
宽度 组件的宽度。 CSSLength (String) '100%'
高度 组件的高度。 CSSLength (String) '100%'
持续时间 组件的过渡持续时间。 CSSTime (String) '0.5s'
过渡 组件的过渡计时功能。 CSSTransitionFunction (String) 'ease-in'

大事记 (Events)

Flipper component pass up every HTMLElement event. So, you can use @click, @mouseover etc.

Flipper组件会传递每个HTMLElement事件。 因此,您可以使用@click@mouseover等。

翻译自: https://vuejsexamples.com/a-component-to-flip-elements-with-a-nice-transition/

vue 页面过渡动画翻转

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值