Files
ClassContent/历届学生/陈一航/2020-04-21/keyword.html
2024-09-27 02:06:13 +08:00

101 lines
2.1 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Title</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
body,ul,li,p,h1,h2,h3,h4 {
margin: 0;
padding: 0;
list-style: none;
}
input {
width: 100%;
height: 60px;
background: #e9e7e7;
font-size: 19px;
}
ul {
position: fixed;
width: 100%;
height: 230px;
bottom: 0;
left: 0;
background: #ededed;
display: flex;
justify-content: space-around;
text-align: center;
flex-wrap: wrap;
}
ul li {
width: 33%;
line-height: 57.5px;
}
.red {
background: red;
}
.green {
background: green;
}
.main {
}
</style>
</head>
<body>
<div class="main">
<input type="text" v-model="UserPhone" placeholder="付款金额">
<ul>
<li v-for="(item,index) in key"
:class="index === 9 ? 'red' : index === 11 ? 'green': '' "
@click="keyClick(item.text)">
{{item.text}}
<img v-if="index === 9" src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/doc/github.svg" alt="">
<img v-if="index === 11" src="https://img-cdn-qiniu.dcloud.net.cn/uniapp/doc/github.svg" alt="">
</li>
</ul>
</div>
</body>
<script>
new Vue({
el: '.main',
data: {
UserPhone: '',
key: [
{ text: 1 },
{ text: 2 },
{ text: 3 },
{ text: 4 },
{ text: 5 },
{ text: 6 },
{ text: 7 },
{ text: 8 },
{ text: 9 },
{ text: '清空' },
{ text: 0 },
{ text: '删除' },
]
},
methods: {
keyClick(item) {
if (typeof item == "number") {
this.UserPhone += item
} else if (item === "清空") {
this.UserPhone = ""
} else if (item === "删除") {
this.UserPhone = this.UserPhone.slice(0,this.UserPhone.length - 1)
}
}
}
})
</script>
</html>