Built with blockbuilder.org
Last active
September 7, 2018 13:49
-
-
Save danharr/69a8cbafab815753c1df4d51c4de4589 to your computer and use it in GitHub Desktop.
vue.js training
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
license: mit |
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> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> | |
<style> | |
.flex { | |
display:flex; | |
} | |
.menu-items { | |
padding:5px; | |
background:#045600; | |
color:white; | |
font-family:arial; | |
width:100%; | |
text-align:center; | |
} | |
button { | |
width:100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div id="app"> | |
<div id="menu" class="flex"> | |
<div @click="menuClick(x)" class="menu-items" v-for="x in menu">{{x}}</div> | |
</div> | |
<h3>Some heading</h3> | |
<div class="flex"> | |
<button @click="buttonClick(x)" v-for="x in buttons">{{x}}</button> | |
</div> | |
</div> | |
<script> | |
var menu = ['a','b','c','d']; | |
var buttons = ['a1','b2','c3','d4']; | |
var vm = new Vue({ | |
el: '#app', | |
data: { | |
menu:menu, | |
buttons:buttons, | |
menuItem:'a' | |
}, | |
methods: { | |
menuClick:function (f) { | |
this.menuItem = f; | |
} , | |
buttonClick:function (f) { | |
} | |
} | |
}) | |
</script> | |
</body> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment