Last active
August 29, 2015 13:57
-
-
Save leaysgur/9580559 to your computer and use it in GitHub Desktop.
How to v-repeat in v-repeat at Vue.js
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
<script src="http://cdnjs.cloudflare.com/ajax/libs/vue/0.8.8/vue.min.js"></script> | |
<ul id="list"> | |
<li v-repeat="monsters"> | |
{{name}} | |
<div v-repeat="types">タイプ{{$index + 1}}: {{$value}}</div> | |
<ul> | |
<li v-repeat="baseStats">{{$root.lang[$key]}}: {{$value}}</li> | |
</ul> | |
</li> | |
</ul> |
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
var lang = { | |
h: 'HP', | |
a: 'こうげき', | |
b: 'ぼうぎょ', | |
c: 'とくこう', | |
d: 'とくぼう', | |
s: 'すばやさ' | |
}; | |
var monsters = [ | |
{ | |
name: 'ラプラス', | |
types: ['みず', 'こおり'], | |
baseStats: { | |
h: 130, a: 85, b: 80, c: 85, d: 95, s: 60 | |
} | |
}, | |
{ | |
name: 'ユキノオー', | |
types: ['くさ', 'こおり'], | |
baseStats: { | |
h: 90, a: 92, b: 75, c: 92, d: 85, s: 60 | |
} | |
} | |
]; | |
var vue = new Vue({ | |
el: '#list', | |
data: { | |
lang: lang, | |
monsters: monsters | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment