Array-Huang / webpack-seed

这是一个基于webpack的多页应用脚手架
https://segmentfault.com/a/1190000006843916
MIT License
1.19k stars 283 forks source link

ERROR in ReferenceError: constructInsideUrl is not defined #13

Closed LiuYashion closed 7 years ago

LiuYashion commented 7 years ago

因为demo里的右侧导航栏是写在公共组件里,自己在学习的时候就想在模板里写一个<%= constructInsideUrl('test/index') %>进行跳转测试,可是总报错: ERROR in ReferenceError: constructInsideUrl is not defined 参照着index-login-html.js写,还是报错,看了一两天.. test目录-src->pages

LiuYashion commented 7 years ago

ERROR in ReferenceError: constructInsideUrl is not defined

Array-Huang commented 7 years ago

你在渲染模板的时候,没把constructInsideUrl方法作为模板参数传进去吧?

src/pages/index/login/html.js

// ……
const noJquery = require('withoutJqueryModule');

// ……

const loginBoxHtml = require('./templates/login-box.ejs')({
  constructInsideUrl: noJquery.constructInsideUrl,
});
// ……