新建文件夹data后新建js文件
var foods = [{
src: '/images/s.png',
id: 1,
name: '苹果',
text: '125'
},
{
src: '/images/s.png',
id: 2,
name: '香蕉',
text: '423'
},
{
src: '/images/s.png',
id: 3,
name: '橘子',
text: '130'
}
]
module.exports = {
foodList: foods
}
引用
var foodData = require('../../../data/food-data.js')