new Vue({
el: '#app',
data: {
title: 'The VueJS Instance - from h1',
text1: 'use bind to treat text for what it says such as a link - from method sayHello2',
showParagraph: false,
link: 'http://google.com'
},
// pre-fixing with this. gives us access to proxies of data and methods in a Vue Instance
methods: {
sayHello1: function() {
return 'Use {{ }} in <h> <p> etc - from method Hello1';
},
sayHello2: function() {
return this.title;
},
sayHello3: function() {
return 'Used Vue bind directive to dynamically link to web shortcut- from method Hello3';
},
show: function() {
this.showParagraph = true;
this.updateTitle('The VueJS Instance (Updated)')
},
updateTitle: function(title) {
this.title = title;
}
},
computed: {
lowercaseTitle: function() {
return this.title.toLowerCase();
}
},
watch: {
title: function(value) {
alert('Title changed, new value: ' + value);
}
}
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.