在methods新增一个方法styleBg 在data定义一个背景样式styleObject对象
styleBg() {
var styleObject = {
background: "url(" + this.base_url + this.train.image + ")",
backgroundSize: "7.5rem" + " " + "4.2rem",
backgroundPosition: "top center",
backgroundRepeat: "no-repeat"
};
this.styleObject=styleObject;
},