------>axios simulation get json cannot get the file. First put the data in the root directory, and then set the static resource access path ('/data',('./data')) in (the file executed by npm) ('/data',('./data'))
... (hotMiddleware) // serve pure static assets var staticPath = (, ) (staticPath, ('./static')) ('/data',('./data'))/*In fact, this is the only line. Pay special attention. This one cannot get json*/ var uri = 'http://localhost:' + port ...
------->I can't get the picture, because the name of the file may change after webpack is packaged. So, you need to look at the configuration file of webpack
{ test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, /* name: ('img/[name].[hash:7].[ext]') This will change the name of the image*/ name: ('img/[name].[ext]') }<br>}
------->There are some values in the data, some are some without them, as follows
[{ "gname":"Xiaomi MIX3", "price":"3499", "img":"http://localhost:8082/static/img/", "goods_des":"OLED display screen, upgrade step calculation algorithm", "review":"I heard that the beautiful girl in Xiaomi's customer service is very good and gave me a hidden poem, but I love Qian Tianyu.", "review_author":"From Orange" },{ "gname":"Xiaomi MIX4", "price":"3499", "img":"http://localhost:8082/static/img/", "goods_des":"6.4 full screen, full ceramic body" }]
OK, when the for loop, you need to add judgments in the corresponding places.
<li v-for="(item,index) in arrList" class="goods-list-item"> <span class="flag flag-new">{{}}</span> <a href="#" rel="external nofollow" class="img-wrap"> <img :src="" /><!--orv-bind:src=""--> </a> <h3 class="good-title"><a href="">{{}}</a></h3> <p class="good-desc">{{item.goods_des}}</p> <p class="good-price">{{}}</p> <p class="review-wrap" v-if=""><!--ifreviewShow if it exists--> <a href=""> <span class="review">{{}}</span> <span class="author">{{item.review_author}}</span> </a> </p> </li>
The above article briefly talks about Vue's trapping path is all the content I share with you. I hope you can give you a reference and I hope you can support me more.