Get the App
SLTechnology News&Howtos  ›  Development  › 

How does vue use v-bind to assign values to src and href

Shulou Source: shulou.com Published: 2022-06-01 00:14:10 09月21日 Update

This article mainly introduces how vue uses v-bind to assign values to src and href, the content is detailed and easy to understand, the operation is simple and fast, and it has a certain reference value. I believe you will get something after reading this vue how to use v-bind to assign values to src and href. Let's take a look at it.

V-bind assigns values to src and href

Using v-bind to assign values to src and href is actually very simple, that is, v-bind: attribute name = "name", where name is the key value of json data in data, its abbreviated form is: attribute name = "name".

Example link link1 link2 la la la

Var ve2 = new Vue ({el:'# app', data: {link: "linkyou.html", link1: "https//www.baidu.com", link2: "www.baidu.com", img: '8.jpg'}}) invalid v-bind:src problem

V-bind:src in vue, the picture cannot be displayed properly

I have nothing to click on the code, ready to inspire, do a good project, review vue by the way, and find that when I simulate json data in data, the picture link does not display properly on the page.

Used a variety of methods, can not be used normally, and finally found that the Internet is the need to introduce the problem.

Attach code / / template

/ / scriptdata () {return {/ / Note: after introduction, both relative and absolute paths can use imgLink: require (".. /.. / assets/img/home/recommend_bg.jpg")}. This is the end of the article on "how vue uses v-bind to assign values to src and href". Thank you for reading! I believe you all have a certain understanding of "how vue uses v-bind to assign values to src and href". If you want to learn more, you are welcome to follow the industry information channel.

Tags: Knowledge code content pictures attributes data articles paths questions value that is form simple operation articles methods time easy to understand more inspiration see Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia Xiaomi Linux MariaDB