Problems with src reference variables in vue's image tag

Using { {variable name}} in the reference variable will cause { {}} to be parsed as a string

It will parse { {}} into %7B%B%7D%7D instead of the variable value.
This is required:
insert image description here
declare in data and assign the variable name to src

data() {
    
    
return {
    
    
msg: "图片加载于" + new Date().toLocaleString(),
src: require("../assets/logo.png")//或者是直接连接的网址
}
},

The href of the same a tag can also be solved in the same way because the { {}} in the href cannot be parsed

<a v-bind:href="url">{
    
    {
    
     name }}</a> <

Add declaration url in data

data() {
    
    
return {
    
    
name: "百度",
url: "https://www.baidu.com/",
}
},

Guess you like

Origin blog.csdn.net/qq_54537215/article/details/125118171