<template> <div id="welcome"> <div id="newwelcome" :class="{ welcome: !newList }"></div> </div> </template> <script> export default { name: "welcome", props: ["flag"], data: function() { return { newList: true }; }, mounted: function() {}, watch: { flag: function(newval, oldval) { this.newList = newval; } } }; </script> <style scoped> #welcome { width: 100%; height: 100%; } #Font { width: 100%; height: 100%; } #newwelcome { background: url("../../static/img/huanyingyehei_img.jpg") no-repeat; background-size: cover; width: 100%; height: 100%; } .welcome { background: url("../../static/img/huanyingye_img.jpg") no-repeat !important; background-size: cover !important; width: 100% !important; height: 100% !important; } </style>