require引用js文件报错,请问我这个文件错哪了?
因为页面JS内容太多、太长了,维护起来特别麻烦,所以想把数据单独放到另一个JS文件进行require引用。
然后:
var houseData = require('../../utils/data.js');
data的路径没有错,但是收到如下报错:
然后data文件代码如下:
var house_data = [
{
id:'001',
projectUrl:'../house/gangzhonglv/gangzhonglv',
imgUrl:'https://6875-huanjingnet-w419c-1302326361.tcb.qcloud.la/Properties/gangZhongLv/gzlhqw.jpg',
name:'2期',
type:'住宅',
price:'22500',
sale:'',
area1:'88',
area2:'140',
location1:'廊坊',
location2:'燕郊',
room:'23',
tip1:'现房',
tip2:'品牌房企',
tip3:'贴心物业',
tip4:'地铁周边',
status: 0,
keyword: '廊坊 燕郊 '
},
{
id:'002',
projectUrl:'../house/jiadu/jiadu',
imgUrl:'https://6875-huanjingnet-w419c-1302326361.tcb.qcloud.la/Properties/jiaDu/jdjhy.jpg',
name:'1期',
type:'住宅',
price:'22000',
sale:'全款92折 贷款94折',
area1:'88',
area2:'117',
location1:'廊坊',
location2:'燕郊',
room:'23',
tip1:'现房',
tip2:'绿化率高',
tip3:'贴心物业',
tip4:'配套齐全',
status: 0,
keyword: '廊坊 燕郊 '
},
]
function getHouse() {
return house_data;
}
module.exports = {
getHouse: getHouse
}
但是还是报错,如下图:
求各位大佬帮忙看看。