From ae1a80869cbf2aa2dec39a193079747d7f1c64cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= <huan0016@gmail.com> Date: Tue, 16 Apr 2024 19:10:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=80=E5=8D=95=E8=A1=A5=E5=85=85=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/account/create.vue | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pages/account/create.vue b/pages/account/create.vue index b0ac7cf..6ed9543 100644 --- a/pages/account/create.vue +++ b/pages/account/create.vue @@ -3,11 +3,32 @@ div.card .left CREATE .right - input(placeholder="account") - input(placeholder="password") - button Submit + input(placeholder="account" v-model="name") + input(placeholder="password" v-model="password") + button(@click="login({name, password})") Submit </template> +<script> +export default { + data: () => ({ + name: "", + password: "", + }), + methods: { + login(data) { + this.$axios.post("/api/user", data).then(res => { + console.log(res.data) + + // 修改页面 .card 为提示注册成功 + const card = document.querySelector('div.card') + if (card) card.innerHTML = '注册成功' + + }); + }, + } +} +</script> + <style lang="sass"> .account-create padding-top: 6rem