除法练习题,二位数除以一位数,自动生成,可以直接打印成A4纸,刚好一页。
需要:VUE。
···
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./jQuery/jquery-3.3.1.min.js"></script>
<script src="./vue_test/vue/vue.js"></script>
<title>计算题</title>
<style>
* {
margin: 0;
padding: 0;
text-decoration: none;
}
.forprint {
margin: 0 auto;
padding-top: 26px;
width: 800px;
height: 1100px;
/* 1160px */
border: grey 1px dotted;
}
h1 {
text-align: center;
font-size: 15px;
}
ul {
text-decoration: none;
list-style-type: none;
}
li {
display: inline-block;
font-size: 30px;
line-height: 117px;
margin-left: 50px;
float: left;
width: 332px;
}
.date {
position: relative;
left: 690px;
font-weight: 600;
}
</style>
</head>
<body>
<div id="app" class="forprint">
<h1 class="title">Dotdot's Excersize</h1>
<span class="date">{{theDate.year}}-{{theDate.month}}-{{theDate.day}}</span>
<div class="container">
<ul v-for="item in items">
<li>{{ item.a }}÷{{item.c}}=____________</li>
</ul>
</div>
</div>
<script>
var division = function (num1, num2) {
var num3 = num1 * num2;
return {a: num3, b: num1, c: num2}
}
var getrandom = function(min, max) {
return Math.floor(Math.random() * (max - min + 1))+ min
}
var vm = new Vue({
el: "#app",
data: {
iswork: "yes"
},
computed: {
items: {
get() {
var list = [];
for (i=0; i<16; i++) {
var num1 = getrandom(1, 99);
var num2 = getrandom(1, 9);
list.push(division(num1, num2))
}
return list
}
},
theDate: {
get() {
var thedate = new Date();
var tyear = thedate.getFullYear();
var tmonth = thedate.getMonth() + 1;
var tday = thedate.getDate();
return {year: tyear, month: tmonth, day: tday}
}
}
}
})
</script>
</body>
</html>
···