[PUG] inputtype =“ submit”,value =“ Search”有什么问题:

问题描述

[nodemon] starting `ts-node src/index.ts`
✅I'm working on https://localhost:4010
Error: /mnt/c/Users/nyang/flock-phone/src/views/index.pug:14:1
    12|                each country in countries
    13|                    option(value=country.code)= `${country.flag} ${country.name}`
  > 14|                 input(type="submit" value="Search" name="Search")
--------^

Inconsistent indentation. Expecting either 15 or 19 spaces/tabs.
    at makeError (/mnt/c/Users/nyang/flock-phone/node_modules/pug-error/index.js:34:13)
    at Lexer.error (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:62:15)
    at Lexer.indent (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:1510:18)
    at Lexer.callLexerFunction (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:1642:23)
    at Lexer.advance (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:1683:12)
    at Lexer.callLexerFunction (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:1642:23)
    at Lexer.getTokens (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:1701:12)
    at lex (/mnt/c/Users/nyang/flock-phone/node_modules/pug-lexer/index.js:12:42)
    at Object.lex (/mnt/c/Users/nyang/flock-phone/node_modules/pug/lib/index.js:104:9)
    at Function.loadString [as string] (/mnt/c/Users/nyang/flock-phone/node_modules/pug-load/index.js:53:24)
GET / 500 3902.067 ms - 1760

这是错误 input(type =“ submit” value =“ Search”) 这是有问题的代码。 有什么问题.... :( 请帮我:(
我重新安装了哈巴狗以对其进行修复,并修复了30分钟,但无法修复。

解决方法

Pug依靠缩进样式。这意味着它使用缩进来计算嵌套的标签或同级标签。您的情况input标签未正确嵌套。它应该与each块具有相同的缩进量。

each country in countries
    option(value=country.code)= `${country.flag} ${country.name}`
input(type="submit" value="Search" name="Search")