为了账号安全,请及时绑定邮箱和手机立即绑定

vue循环问题

vue循环问题

qq_花开花谢_0 2018-11-13 13:13:05
vue能循环一个固定变量嘛?比如说我num=3我要循环num次<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Document</title><script src="https://unpkg.com/vue@2.3.3"></script></head><body><div id="app">    <div v-for="n in full"></div>    <div v-if="ishalf"></div>    <div v-for="n in empty"></div></div><script>    const MAXSIZE = 5;    var vm = new Vue({        el : '#app',        props: {            score:{                type: Number,                defualt: 4.5            }        },        data:{            num : 3        },        created(){            this.full = Math.floor(this.score);            this.ishalf = this.score!=this.full;            this.empty = Math.floor(MAXSIZE-this.score);        }    })</script></body></html>
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 472 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信