概要
plunkerでvueやってみた。
練習問題、やってみた。
練習問題
vueファイルでzundokoを書け。
写真
サンプルコード
<template>
<div>
<h2>zundoko</h2>
<span v-for="s in zundoko"> {{ s }} </span>
</div>
</template>
<script>
define(['Vue'], function(Vue) {
return new Vue({
template: template,
data: {
zundoko: [],
zudo: ["ズン", "ドコ"],
c: 0,
i: 0
},
created() {
while(1)
{
this.i = Math.floor(Math.random() * 2);
this.zundoko.push(this.zudo[this.i]);
if (this.i == 0)
{
if (this.c <= 4)
this.c++;
}
else
{
if (this.c >= 4)
break;
else
this.c = 0;
}
}
this.zundoko.push("キ・ヨ・シ!");
},
methods: {
}
})
});
</script>
<style>
</style>
成果物
以上。