vue3,js版,我想用async await该怎么写?

vue2我这样写没问题,vue3,js版我改怎么写。

export default {

name: 'Login',

data() {

return {

};

},

created() {

this.getSession();

},

methods: {

async handleLogin() {

const res1 = await this.$API.login.login(this.loginForm)

}

}

};


回答:

其实是一样的:

<script setup>

import { ref } from 'vue'

function d () {}

async function f () {

await d()

}

const msg = ref('Hello World!')

</script>

<template>

<h1>{{ msg }}</h1>

<input v-model="msg">

</template>

以上是 vue3,js版,我想用async await该怎么写? 的全部内容, 来源链接: utcz.com/p/934119.html

回到顶部