100 Star 968 Fork 268

umicro / uView2.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
transition.nvue 4.89 KB
一键复制 编辑 原始数据 按行查看 历史
uView UI 提交于 2021-10-06 21:09 . 初始化仓库
<template>
<view class="u-page">
<u-gap height="20" bgColor="#fff"></u-gap>
<u-cell-group border>
<u-cell
:titleStyle="{ fontWeight: 500 }"
@click="openTransition(item.mode)"
:title="item.title"
v-for="(item, index) in list"
:key="index"
clickable
>
<image
slot="icon"
class="u-cell-icon"
:src="item.iconUrl"
mode="widthFix"
></image>
</u-cell>
<u-transition
:mode="mode"
:show="show"
:custom-style="style"
@click="click"
@beforeEnter="beforeEnter"
@enter="enter"
@afterEnter="afterEnter"
@beforeLeave="beforeLeave"
@leave="leave"
@afterLeave="afterLeave"
>
<view class="transition"></view>
</u-transition>
</u-cell-group>
</view>
</template>
<script>
export default {
data() {
return {
mode: "",
show: false,
style: {
position: "fixed",
top: `${uni.$u.sys().windowHeight / 2 - 50}px`,
left: `${uni.$u.sys().windowWidth / 2 - 50}px`,
width: "120px",
height: "120px",
backgroundColor: "#1989fa",
},
list: [
{
mode: "fade",
title: "淡入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/fade.png",
},
{
mode: "fade-up",
title: "上滑淡入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/fadeUp.png",
},
{
mode: "zoom",
title: "缩放",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/zoom.png",
},
{
mode: "fade-zoom",
title: "缩放淡入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/fadeZoom.png",
},
{
mode: "fade-down",
title: "下滑淡入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/fadeDown.png",
},
{
mode: "fade-left",
title: "左滑淡入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/fadeLeft.png",
},
{
mode: "fade-right",
title: "右滑淡入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/fadeRight.png",
},
{
mode: "slide-up",
title: "上滑进入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/slideUp.png",
},
{
mode: "slide-down",
title: "下滑进入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/slideDown.png",
},
{
mode: "slide-left",
title: "左滑进入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/slideLeft.png",
},
{
mode: "slide-right",
title: "右滑进入",
iconUrl:
"https://cdn.uviewui.com/uview/demo/transition/slideRight.png",
},
],
};
},
mixins: [uni.$u.mixin],
methods: {
openTransition(mode) {
this.mode = mode;
this.show = true;
setTimeout(() => {
this.show = false;
}, 1500);
},
click() {
// console.log("click");
},
beforeEnter() {
// console.log("beforeEnter");
},
enter() {
// console.log("enter");
},
afterEnter() {
// console.log("afterEnter");
},
beforeLeave() {
// console.log("beforeLeave");
},
leave() {
// console.log("leave");
},
afterLeave() {
// console.log("afterLeave");
},
},
};
</script>
<style lang="scss">
.u-page {
padding: 0;
}
.transition {
background-color: $u-primary;
}
</style>
JavaScript
1
https://gitee.com/umicro/uView2.0.git
git@gitee.com:umicro/uView2.0.git
umicro
uView2.0
uView2.0
master

搜索帮助