用vue代码实现忘记密码页面,提交新密码之前,弹出一个确认框
时间: 2023-03-27 19:04:24 浏览: 103
可以使用以下代码实现:
<template>
<div>
<h1>忘记密码</h1>
<form>
<label for="email">邮箱:</label>
<input type="email" id="email" v-model="email">
<br>
<label for="password">新密码:</label>
<input type="password" id="password" v-model="password">
<br>
<button @click.prevent="submit">提交</button>
</form>
<div v-if="showConfirm">
<p>确定要提交新密码吗?</p>
<button @click="confirm">确定</button>
<button @click="cancel">取消</button>
</div>
</div>
</template>
<script>
export default {
data() {
return {
email: '',
password: '',
showConfirm: false
}
},
methods: {
submit() {
this.showConfirm = true
},
confirm() {
// 提交新密码的逻辑
this.showConfirm = false
},
cancel() {
this.showConfirm = false
}
}
}
</script>
阅读全文