Skip to content

Commit 5cfa2c9

Browse files
committed
update example
1 parent f353fe9 commit 5cfa2c9

File tree

10 files changed

+12587
-12
lines changed

10 files changed

+12587
-12
lines changed

babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/cli-plugin-babel/preset'
4+
]
5+
}

package-lock.json

Lines changed: 12360 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
11
{
2-
"type": "module"
3-
}
2+
"name": "temp",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"axios": "^0.26.1",
12+
"core-js": "^3.6.5",
13+
"vue": "^2.6.11"
14+
},
15+
"devDependencies": {
16+
"@vue/cli-plugin-babel": "~4.5.4",
17+
"@vue/cli-plugin-eslint": "~4.5.4",
18+
"@vue/cli-service": "~4.5.4",
19+
"babel-eslint": "^10.1.0",
20+
"eslint": "^6.7.2",
21+
"eslint-plugin-vue": "^6.2.2",
22+
"vue-template-compiler": "^2.6.11"
23+
},
24+
"eslintConfig": {
25+
"root": true,
26+
"env": {
27+
"node": true
28+
},
29+
"extends": [
30+
"plugin:vue/essential",
31+
"eslint:recommended"
32+
],
33+
"parserOptions": {
34+
"parser": "babel-eslint"
35+
},
36+
"rules": {}
37+
},
38+
"browserslist": [
39+
"> 1%",
40+
"last 2 versions",
41+
"not dead"
42+
]
43+
}

public/favicon.ico

4.19 KB
Binary file not shown.

public/index.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title><%= htmlWebpackPlugin.options.title %></title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

src/App.vue

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<template>
2+
<div id="app">
3+
<img alt="Vue logo" src="./assets/logo.png" /><br />
4+
<span><strong>本项目由 Vue.js 驱动</strong></span
5+
><br /><br />
6+
<span
7+
><a href="https://github.com/NeserCode/Leetcode-Api" target="_blank">
8+
<img
9+
title="GitHub stars"
10+
src="https://img.shields.io/github/stars/NeserCode/Leetcode-Api?style=flat" /></a
11+
>&nbsp;&nbsp;
12+
<img
13+
title="GitHub download"
14+
src="https://img.shields.io/github/downloads/NeserCode/Leetcode-Api/total?label=GitHub&style=social"
15+
/>
16+
</span>
17+
<Home />
18+
</div>
19+
</template>
20+
21+
<script>
22+
import Home from "./components/Home.vue";
23+
24+
export default {
25+
name: "App",
26+
components: {
27+
Home,
28+
},
29+
};
30+
</script>
31+
32+
<style>
33+
#app {
34+
font-family: Avenir, Helvetica, Arial, sans-serif;
35+
-webkit-font-smoothing: antialiased;
36+
-moz-osx-font-smoothing: grayscale;
37+
text-align: center;
38+
color: #2c3e50;
39+
margin-top: 60px;
40+
}
41+
</style>

src/assets/logo.png

6.69 KB
Loading

src/components/Home.vue

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<template>
2+
<div class="home">
3+
<div class="main">
4+
<div class="typedContainer">
5+
<input
6+
type="text"
7+
spellcheck="false"
8+
placeholder=" "
9+
id="session"
10+
class="cookie"
11+
v-model="cookie.session"
12+
/><label class="lab" for="session"> 🖊 Cookie leetcode_session </label>
13+
</div>
14+
<div class="typedContainer">
15+
<input
16+
type="text"
17+
spellcheck="false"
18+
placeholder=" "
19+
id="csrftoken"
20+
class="cookie"
21+
v-model="cookie.csrftoken"
22+
/><label class="lab" for="csrftoken"> 🖊 Cookie x-csrftoken </label>
23+
</div>
24+
</div>
25+
</div>
26+
</template>
27+
28+
<script>
29+
export default {
30+
name: "Home",
31+
mounted() {
32+
this.init();
33+
},
34+
data() {
35+
return {
36+
cookie: {
37+
session: null,
38+
csrftoken: null,
39+
},
40+
};
41+
},
42+
methods: {
43+
init: function () {
44+
console.log(this);
45+
},
46+
},
47+
};
48+
</script>
49+
50+
<style scoped>
51+
.main {
52+
width: 100%;
53+
height: 100%;
54+
padding: 3rem 0;
55+
padding-top: 6rem;
56+
}
57+
58+
.typedContainer {
59+
position: relative;
60+
width: 40rem;
61+
margin: 0 auto;
62+
margin-bottom: 4rem;
63+
}
64+
.cookie {
65+
width: 60%;
66+
font-size: 1.25rem;
67+
}
68+
69+
.lab {
70+
position: absolute;
71+
top: 0.85rem;
72+
left: 8rem;
73+
padding-bottom: 0.5rem;
74+
display: inline-block;
75+
font-size: 1.5rem;
76+
transition: all ease-in-out 0.4s;
77+
}
78+
</style>
79+
80+
<style>
81+
input {
82+
display: inline-block;
83+
outline: none;
84+
border: none;
85+
border-bottom: #aaa solid 2px;
86+
color: #aaa;
87+
background-color: transparent;
88+
transition: all ease-in-out 0.2s;
89+
padding-bottom: 8px;
90+
padding-left: 4px;
91+
opacity: 0;
92+
}
93+
input:focus {
94+
border-bottom: #333 solid 2px;
95+
color: #333;
96+
opacity: 1;
97+
}
98+
input:not(:focus) + label {
99+
color: #ccc;
100+
transform: translateX(0%);
101+
}
102+
input:focus + label {
103+
transform: translateY(-150%);
104+
font-weight: bolder;
105+
}
106+
input:not(:focus):not(:placeholder-shown) {
107+
opacity: 1;
108+
}
109+
input:not(:focus):not(:placeholder-shown) + label {
110+
opacity: 0;
111+
}
112+
</style>
File renamed without changes.

src/main.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Vue from 'vue'
2+
import App from './App.vue'
3+
import leetcode from './leetcode/index.js'
4+
5+
Vue.config.productionTip = false
6+
Vue.prototype.$leetcode = new leetcode()
7+
8+
new Vue({
9+
render: h => h(App),
10+
}).$mount('#app')

0 commit comments

Comments
 (0)