Last active
April 12, 2018 18:14
-
-
Save korzio/4650c6a648f66a186260ac98fc1cd6f6 to your computer and use it in GitHub Desktop.
links.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Welcome to Vue</title> | |
<script src="https://unpkg.com/vue"></script> | |
</head> | |
<body> | |
<div id="app"> | |
<ul> | |
<li v-for="url in links"> | |
<my-link v-bind:url="url"></my-link> | |
</li> | |
</ul> | |
</div> | |
<script> | |
Vue.component('my-link', { | |
props: ['url'], | |
methods: { | |
humanizeURL: function (url) { | |
return url | |
.replace(/^https?:\/\//, '') | |
.replace(/\/$/, '') | |
}, | |
}, | |
template: '<a v-bind:href="url">{{ url }}</a>' | |
}) | |
var app = new Vue({ | |
el: '#app', | |
data: { | |
links: [ | |
'http://vuejs.org/guide/', | |
'https://chat.vuejs.org', | |
'http://forum.vuejs.org/' | |
] | |
}, | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment