I write the style in the calculation properties in the components of the project. I want to set the background-image of the style dynamically, but I encounter some problems in the process. How can I solve
data () {
return {
tab_active: "ma",
bgUrl: "@/assets/images/stamps/icon-auditing.png"
}
},
computed: {
imgStyle () {
if (this.bgUrl) {
var img = require(this.bgUrl) //this.bgUrl"@/assets/images/stamps/icon-auditing.png"
var url = `url(${img})`
console.log(url)
return {
"background-image": url,
"background-position": "center center",
"background-size": "auto 100%",
"background-repeat": "no-repeat"
}
}
},
}
the error is as follows