App.vue:
created() {
this.loadImg();
},
methods: {
// 加载图片
loadImg() {
const imgPaths = [
'./images/mb1-page.jpg',
'css里面写的图片路径‘【background: url("./images/mb1-page.jpg") center no-repeat;】’
];
imgPaths.forEach((item) => {
const img = new Image();
img.src = item;
});
}
}
或者在App.vue里面加隐藏的div