vue binding
// with v=bind
<p><a v-bind:href="website">Text goes here fo the link </a> </p>
//or with :
<p><a :href="website">Text goes here fo the link </a> </p>
//website is variable/property with link in a Vue instance
4
1
<div v-bind:class="{ active: isActive }"></div>
The above syntax means the presence of the active class will be determined by the truthiness of the data property isActive.
Thank you!
1
0
4
7
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
<title>JS Bin</title>
</head>
<body>
<div id="appRoot">
<template>
<button
:disabled="disabled ? false : true"
:style="{color: disabled ? 'blue' : 'red'}"
:class="[background, text]"
>{{ disabled ? "active" : "not active" }}</button>
</template>
</div>
</body>
<script>
new Vue({
name: "app",
el: "#appRoot",
data() {
return {
disabled: true,
background: "bg-success",
text: "text-white"
}
}
})
</script>
</html>
Thank you!
7
0
4
1
<div v-html="html"></div>
<!-- same as -->
<div>{{{ html }}}</div>
Thank you!
1
0
Are there any code examples left?
New code examples in category Other
-
Other 2023-03-27 22:50:10 how to select the whole line in vscode with keyboard shortcut
-
Other 2022-03-27 22:45:24 income of a web developer
-
Other 2022-03-27 22:35:01 \pyrcc_main.py: File does not exist 'resources.qrc'
-
Other 2022-03-27 22:30:45 rick roll embed code
-
Other 2022-03-27 22:20:08 Circuit_04_Potentiometer
-
Other 2022-03-27 22:20:05 iterative power
-
Other 2022-03-27 22:15:11 flutter run all
-
Other 2022-03-27 22:10:05 when is karlson release
-
Other 2022-03-27 22:10:02 wp .htaccess example
-
Other 2022-03-27 22:00:08 bash pause in file read line by line