0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

plunkerでvue その59

Posted at

概要

plunkerでvueやってみた。
練習問題、やってみた。

練習問題

vueファイルでzundokoを書け。

写真

image.png

サンプルコード


<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>




成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?