1、源码
Mock.mock("http://www.baidu.com/api", "get", {
data: {
"level|1-10": "★",
articleImage: Mock.Random.image('200×100','#ff600','新闻页面'),
},
});
跟着视频敲得,老师点开就是图片,我打开的咋是这样
2、进行修改,点进mock示例官网,找到Random.image
mock示例官网
进行复制官网显示的内容:
// Random.image()
Random.image()
// Random.image( size )
Random.image('200x100')
// Random.image( size, background )
Random.image('200x100', '#FF6600')
// Random.image( size, background, text )
Random.image('200x100', '#4A7BF7', 'Hello')
// Random.image( size, background, foreground, text )
Random.image('200x100', '#50B347', '#FFF', 'Mock.js')
// Random.image( size, background, foreground, format, text )
Random.image('200x100', '#894FC4', '#FFF', 'png', '!')
就正常显示图片成功了