JSFiddle - React, Tailwind, and code Playground
by andyjh07
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>VueJS Basic Practice - Challenge 1</title>
</head>
<body>
<div id="exercise">
<p>VueJS is pretty cool! - {{ name }}, {{ age }}</p>
<p>My age x 3 is = {{ multipliedAge() }}</p>
<p>Random number between 0 and 1 = {{ randomNumber() }}</p>
<img v-bind:src="link" style="width:100px;height:100px;display:block;">
<input type="text" v-bind:value="name">
</div>
</body>
</html>
JavaScript
new Vue({
el: '#exercise',
data: {
name: 'Mark',
age: 31,
link: 'https://picsum.photos/100'
},
methods: {
multipliedAge: function() {
return this.age * 3;
},
randomNumber: function() {
return Math.random(0, 1);
}
}
})