Created
April 15, 2019 02:31
-
-
Save ritcheyer/d682909701f6a0131fe2b776960d40c9 to your computer and use it in GitHub Desktop.
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
Vue.component('list-item', { | |
props: ['text', 'link'], | |
template: '<li><a :href="link">{{ text }}</a></li>' | |
}) | |
new Vue({ | |
el: '#sidemenu', | |
data: { | |
links: [ | |
{ id: 0, text: 'Index', link: '/' }, | |
{ id: 1, text: 'Tutorials', link: '/tutorials' }, | |
{ id: 2, text: 'Components', link: '/components' }, | |
{ id: 2, text: 'Vue ChartJS', link: '/charts' } | |
] | |
} | |
}) |
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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="x-ua-compatible" content="ie=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Learning VueJS</title> | |
<link rel="stylesheet" href="/assets/css/app.css"> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/kognise/water.css@latest/dist/dark.css"> | |
<link rel="icon" href="assets/img/vuejs.png"> | |
</head> | |
<body> | |
<div class="page-wrap"> | |
<h1>Pages</h1> | |
<main class="main-wrap"> | |
<ol id="sidemenu"> | |
<list-item | |
v-for="(link, index) in links" | |
:key="index" | |
v-bind:text="link.text" | |
v-bind:href="link.url" | |
></list-item> | |
</ol> | |
</main> | |
</div> | |
<!-- development version, includes helpful console warnings --> | |
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> | |
<script src="/assets/js/app.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Figured it out. switched from
link
tourl
in the dataset (and references in the template). I think it was getting hung up on the fact that i was usinglink
in the dataset as well aslink
as the item in thefor
loop.