【发布时间】:2021-03-11 15:42:54
【问题描述】:
注册新帐户后,我会在屏幕上显示登录名和密码详细信息。用户可以将登录和密码详细信息复制到剪贴板,我想在单击附加图标(放大、增加字体或替换为另一个图标)时运行动画。这样做的正确方法是什么?
<template>
<v-card class="col-12 col-md-8 col-lg-6 p-6 px-16" elevation="4">
<div class="title h2 mb-10 text-uppercase text-center">
Success
<v-icon color="green" x-large>
mdi-check-circle
</v-icon>
</div>
<v-text-field
:value="newAccount.login"
label="Login"
outlined
readonly
append-icon="mdi-content-copy"
ref='login'
@click:append="copy('login')"
></v-text-field>
<v-text-field
:value="newAccount.password"
label="Password"
outlined
readonly
append-icon="mdi-content-copy"
ref='login'
@click:append="copy('login')"
></v-text-field>
</v-card>
</template>
<script>
methods: {
copy(field) {
const input = this.$refs[field].$refs.input
input.select()
document.execCommand('copy')
input.setSelectionRange(0,0)
// apply append-icon animation
}
}
</script>
【问题讨论】:
-
你想到了什么动画?
-
它可以是任何东西:1)放大或增加字体大小,2)或只是用另一个图标替换,例如'mdi-检查'
标签: vue.js vuetify.js