1、错误描述
F:dojoabcdabccviewsmainmain.pug:10:1 8| include header.pug 9| div(id='main') > 10| mixin result --------^ 11| ui 12| li #{result.user_name} 13| include left.pug Mixin result declared without body
Error: F:dojoabcdabccviewsmainmain.pug:10:1
8| include header.pug
9| div(id='main')
> 10| mixin result
--------^
11| ui
12| li #{result.user_name}
13| include left.pug
Mixin result declared without body
at makeError (F:dojoabcdabcc
ode_modulespug-errorindex.js:32:13)
at Parser.error (F:dojoabcdabcc
ode_modulespug-parserindex.js:53:15)
at Parser.parseMixin (F:dojoabcdabcc
ode_modulespug-parserindex.js:871:12)
at Parser.parseExpr (F:dojoabcdabcc
ode_modulespug-parserindex.js:204:21)
at Parser.parse (F:dojoabcdabcc
ode_modulespug-parserindex.js:112:25)
at parse (F:dojoabcdabcc
ode_modulespug-parserindex.js:12:20)
at Object.parse (F:dojoabcdabcc
ode_modulespuglibindex.js:126:22)
at Function.loadString [as string] (F:dojoabcdabcc
ode_modulespug-loadindex.js:45:21)
at compileBody (F:dojoabcdabcc
ode_modulespuglibindex.js:86:18)
at Object.exports.compile (F:dojoabcdabcc
ode_modulespuglibindex.js:243:16)
2、错误原因
doctype html
html
head
style
link(rel='stylesheet', href='../../stylesheets/main.css')
body
block content
include header.pug
div(id='main')
mixin result
ui
li #{result.user_name}
include left.pug
router.get('/main',function(req,res){
var conn = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'root',
database: 'cdm'
});
conn.connect();
conn.query('select * from b_user',function(error,results,fields){
if(error) throw error;
console.log(results);
res.render('main/main',{result:results});
});
});
3、解决办法