LandingPage.vue
2.6 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
<div id="wrapper">
<img id="logo" src="~@/assets/logo.png" alt="electron-vue">
<main>
<div class="left-side">
<span class="title">Welcome to your new project!</span>
<system-information></system-information>
<div>
<span>{{text}}</span>
</div>
<div v-for="(itme,index) in textarray" :key="index">
<span>{{itme._id}}</span>
<span>{{itme.name}}</span>
<span>{{itme.age}}</span>
</div>
</div>
<div class="right-side">
<div class="doc">
<div class="title alt">Other Documentation</div>
<el-button type="primary" round @click="open()">控制台打印</el-button>
<el-button type="primary" round @click="setdata">写入数据</el-button>
<el-button type="primary" round @click="getdata">读取数据</el-button>
<el-button type="primary" round @click="deledata">清除所有数据</el-button>
</div>
</div>
</main>
</div>
</template>
<script>
import SystemInformation from "./LandingPage/SystemInformation";
export default {
name: "landing-page",
components: { SystemInformation },
data: () => ({
text: "等待数据读取",
newdata: {
name: "yyy",
age: "12"
},
textarray: []
}),
methods: {
open(link) {
console.log(this.$electron);
},
setdata() {
this.$db
.adddata(this.newdata)
.then(res => console.log(res))
.catch(err => console.log(err));
},
getdata() {
this.$db
.finddata()
.then(res => {
console.log(res);
this.textarray = res;
console.log(this.textarray);
})
.catch(err => console.log(err));
},
deledata(){
this.$db.deleall().then(res=>{
})
}
}
};
</script>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Source Sans Pro", sans-serif;
}
#wrapper {
background: radial-gradient(
ellipse at top left,
rgba(255, 255, 255, 1) 40%,
rgba(229, 229, 229, 0.9) 100%
);
height: 100vh;
padding: 60px 80px;
width: 100vw;
}
#logo {
height: auto;
margin-bottom: 20px;
width: 420px;
}
main {
display: flex;
justify-content: space-between;
}
main > div {
flex-basis: 50%;
}
.left-side {
display: flex;
flex-direction: column;
}
.welcome {
color: #555;
font-size: 23px;
margin-bottom: 10px;
}
.title {
color: #2c3e50;
font-size: 20px;
font-weight: bold;
margin-bottom: 6px;
}
.title.alt {
font-size: 18px;
margin-bottom: 10px;
}
.doc p {
color: black;
margin-bottom: 10px;
}
</style>