reason:
The await keyword is only valid in async function. If you use await outside the async function, you will only get a syntax error.
Modified code
this.$refs.formRef.validate(async (varlid) => {
if (!varlid) return
const result = await this.$http.post('login', this.loginForm)
console.log(result)
Read More:
- [development experience] solution to unexpected syntax error: unexpected identifier in JSON parsing
- [Fixed] Syntax error: word unexpected (expecting “)”)
- Syntax error: word unexpected (expecting “)”)
- Syntax error: unexpected EOF while parsing
- SyntaxError: unexpected EOF while parsing
- Deep understanding of async await asynchronous programming synchronization
- Parsing error: Unexpected token
- Promise. All cooperates with await to implement synchronous execution of multiple requests
- Solving word experienced an error trying to open the file in word
- Word failed to convert PDF, export failed due to an unexpected error
- Vue の NPM run serve error: parsing error: unexpected token<
- FreeMarker generates word file, and word file cannot open the solution.
- Springboot project: error parsing HTTP request header note: further occurrences of HTTP request parsing
- [Vue warn]: Do not use built-in or reserved HTML elements as component id: article
- Hbase Native memory allocation (mmap) failed to map xxx bytes for committing reserved memory
- Unexpected syntax error: unexpected token<
- “Unexpected syntax error: unexpected identifier”.
- Solve the problem of slow startup of word2019
- Solve the problem of syntax error: unexpected end of file or syntax error near unexpected token ` fi ‘error
- Endnote inserting documents causes word to crash! ! Solution