- 为 x-button 和 x-popup 组件添加注释说明 - 在 x-image 组件中添加 lazy 加载属性 - 优化 profile 页面的我的拍品列表展示 - 更新 tang
31 lines
615 B
Vue
31 lines
615 B
Vue
<script setup>
|
|
/*
|
|
* 此组件的目的是使用该组件包裹的内容具有按压状态效果
|
|
* */
|
|
import {ref, defineEmits} from "vue";
|
|
|
|
const emit = defineEmits(["click"]);
|
|
|
|
const isButtonActive = ref(false);
|
|
|
|
const handleButtonPress = () => {
|
|
isButtonActive.value = true;
|
|
};
|
|
const handleButtonRelease = () => {
|
|
isButtonActive.value = false;
|
|
emit("click")
|
|
};
|
|
</script>
|
|
<template>
|
|
<div
|
|
:class="[
|
|
'transition-all duration-200',
|
|
isButtonActive ? 'scale-95' : ''
|
|
]"
|
|
@touchstart="handleButtonPress"
|
|
@touchend="handleButtonRelease"
|
|
>
|
|
<slot></slot>
|
|
</div>
|
|
</template>
|