-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomponent.js
77 lines (70 loc) · 1.72 KB
/
component.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Vue.component('hand-img', {
props: ['tile'],
template: '<img v-bind:src="\'tile/\' + tile.tileCode + \'.gif\'" />'
});
var init = new Vue({
data: {
handInfo: start(),
}
})
var winHand = new Vue({
el: '#winHand',
data: {
},
computed: {
tileList: function () {
let json = [];
for (let j=0; j < 2*14; j = j+2) {
json.push(JSON.parse(
'{"tileCode": ' + '"' + init.handInfo.winHand.join('').substr(j, 2) + '"}'
));
}
return json;
},
}
});
var changkuang = new Vue({
el: '#changkuang',
computed: {
roundwind: function () {
return kazekanji[+init.handInfo.bakaze.substr(0,1) - 1] + "局";
},
selfwind: function () {
return kazekanji[+init.handInfo.jikaze.substr(0,1) - 1] + "家";
},
tsumoron: function () {
return init.handInfo.tsumo ? "自摸" : "荣和";
},
richibang: function () {
return "立直棒x" + init.handInfo.riichibou;
},
honba: function () {
return "本场棒x" + init.handInfo.honba;
},
}
});
var pointsInput = new Vue({
el: '#pointsInput',
data: {
showAnswer: false,
},
methods: {
checkAnswer: function () {
this.showAnswer = true;
}
},
computed: {
totalPoint: function () {
return init.handInfo.totalPoint;
},
}
});
var nextQuestion = new Vue({
el: '#nextQuestion',
methods: {
nextQuestion: function getNewQuestion() {
init.handInfo = start();
pointsInput.showAnswer = false;
}
}
});