parent
8e1a25a9c0
commit
7f08beda6d
16 changed files with 19699 additions and 0 deletions
Binary file not shown.
@ -0,0 +1,23 @@ |
||||
.DS_Store |
||||
node_modules |
||||
/dist |
||||
|
||||
|
||||
# local env files |
||||
.env.local |
||||
.env.*.local |
||||
|
||||
# Log files |
||||
npm-debug.log* |
||||
yarn-debug.log* |
||||
yarn-error.log* |
||||
pnpm-debug.log* |
||||
|
||||
# Editor directories and files |
||||
.idea |
||||
.vscode |
||||
*.suo |
||||
*.ntvs* |
||||
*.njsproj |
||||
*.sln |
||||
*.sw? |
@ -0,0 +1,24 @@ |
||||
# frontend |
||||
|
||||
## Project setup |
||||
``` |
||||
npm install |
||||
``` |
||||
|
||||
### Compiles and hot-reloads for development |
||||
``` |
||||
npm run serve |
||||
``` |
||||
|
||||
### Compiles and minifies for production |
||||
``` |
||||
npm run build |
||||
``` |
||||
|
||||
### Lints and fixes files |
||||
``` |
||||
npm run lint |
||||
``` |
||||
|
||||
### Customize configuration |
||||
See [Configuration Reference](https://cli.vuejs.org/config/). |
@ -0,0 +1,5 @@ |
||||
module.exports = { |
||||
presets: [ |
||||
'@vue/cli-plugin-babel/preset' |
||||
] |
||||
} |
@ -0,0 +1,19 @@ |
||||
{ |
||||
"compilerOptions": { |
||||
"target": "es5", |
||||
"module": "esnext", |
||||
"baseUrl": "./", |
||||
"moduleResolution": "node", |
||||
"paths": { |
||||
"@/*": [ |
||||
"src/*" |
||||
] |
||||
}, |
||||
"lib": [ |
||||
"esnext", |
||||
"dom", |
||||
"dom.iterable", |
||||
"scripthost" |
||||
] |
||||
} |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,45 @@ |
||||
{ |
||||
"name": "frontend", |
||||
"version": "0.1.0", |
||||
"private": true, |
||||
"scripts": { |
||||
"serve": "vue-cli-service serve", |
||||
"build": "vue-cli-service build", |
||||
"lint": "vue-cli-service lint" |
||||
}, |
||||
"dependencies": { |
||||
"axios": "^0.27.2", |
||||
"core-js": "^3.8.3", |
||||
"jquery": "^3.6.1", |
||||
"vue": "^3.2.13" |
||||
}, |
||||
"devDependencies": { |
||||
"@babel/core": "^7.12.16", |
||||
"@babel/eslint-parser": "^7.12.16", |
||||
"@vue/cli-plugin-babel": "~5.0.0", |
||||
"@vue/cli-plugin-eslint": "~5.0.0", |
||||
"@vue/cli-service": "~5.0.0", |
||||
"eslint": "^7.32.0", |
||||
"eslint-plugin-vue": "^8.0.3" |
||||
}, |
||||
"eslintConfig": { |
||||
"root": true, |
||||
"env": { |
||||
"node": true |
||||
}, |
||||
"extends": [ |
||||
"plugin:vue/vue3-essential", |
||||
"eslint:recommended" |
||||
], |
||||
"parserOptions": { |
||||
"parser": "@babel/eslint-parser" |
||||
}, |
||||
"rules": {} |
||||
}, |
||||
"browserslist": [ |
||||
"> 1%", |
||||
"last 2 versions", |
||||
"not dead", |
||||
"not ie 11" |
||||
] |
||||
} |
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,17 @@ |
||||
<!DOCTYPE html> |
||||
<html lang=""> |
||||
<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"> |
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
||||
<title><%= htmlWebpackPlugin.options.title %></title> |
||||
</head> |
||||
<body> |
||||
<noscript> |
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> |
||||
</noscript> |
||||
<div id="app"></div> |
||||
<!-- built files will be auto injected --> |
||||
</body> |
||||
</html> |
@ -0,0 +1,29 @@ |
||||
<template> |
||||
<BlogHeader /> |
||||
<ArticleList /> |
||||
<BlogFooter /> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import ArticleList from '@/components/ArticleList.vue' |
||||
import BlogHeader from '@/components/BlogHeader.vue' |
||||
import BlogFooter from '@/components/BlogFooter.vue' |
||||
|
||||
export default { |
||||
name: 'App', |
||||
components: { |
||||
ArticleList, |
||||
BlogHeader, |
||||
BlogFooter, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
#app { |
||||
font-family: Georgia, Arial, sans-serif; |
||||
margin-left: 40px; |
||||
margin-right: 40px; |
||||
} |
||||
</style> |
@ -0,0 +1,73 @@ |
||||
<template> |
||||
<div v-for="article in articles" :key="article.url" id="articles"> |
||||
<span |
||||
v-for="tag in article.tags" |
||||
v-bind:key="tag" |
||||
class="tag" |
||||
> |
||||
{{ tag }} |
||||
</span> |
||||
<div class="article-title"> |
||||
{{ article.title }} |
||||
</div> |
||||
{{ formatted_time(article.created) }} |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
import $ from 'jquery' |
||||
import { ref } from 'vue' |
||||
|
||||
export default { |
||||
name: "ArticleList", |
||||
setup() { |
||||
|
||||
let articles = ref([]); |
||||
$.ajax({ |
||||
url: "http://127.0.0.1:6789/api/article/", |
||||
type: "GET", |
||||
success: resp => { |
||||
articles.value = resp.results |
||||
} |
||||
}); |
||||
|
||||
const formatted_time = (iso_date_string) => { |
||||
const date = new Date(iso_date_string); |
||||
return date.toLocaleDateString() |
||||
}; |
||||
|
||||
return { |
||||
articles, |
||||
formatted_time, |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
|
||||
<style scoped> |
||||
|
||||
#articles { |
||||
padding: 10px; |
||||
} |
||||
|
||||
.article-title { |
||||
font-size: large; |
||||
font-weight: bolder; |
||||
color: black; |
||||
text-decoration: none; |
||||
padding: 5px 0 5px 0; |
||||
} |
||||
|
||||
.tag { |
||||
padding: 2px 5px 2px 5px; |
||||
margin: 5px 5px 5px 0; |
||||
font-family: Georgia, Arial, sans-serif; |
||||
font-size: small; |
||||
background-color: #4e4e4e; |
||||
color: whitesmoke; |
||||
border-radius: 5px; |
||||
} |
||||
|
||||
</style> |
@ -0,0 +1,27 @@ |
||||
<template> |
||||
<div id="footer"> |
||||
<p>© bnblogs.cc</p> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
export default { |
||||
name: "BlogFooter", |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
#footer { |
||||
position: fixed; |
||||
left: 0; |
||||
bottom: 0; |
||||
height: 50px; |
||||
width: 100%; |
||||
background: whitesmoke; |
||||
text-align: center; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
</style> |
@ -0,0 +1,22 @@ |
||||
<template> |
||||
<div id="header"> |
||||
<h1>My Drf-Vue Blog</h1> |
||||
<hr> |
||||
</div> |
||||
</template> |
||||
|
||||
<script> |
||||
|
||||
export default { |
||||
name: "BlogHeader", |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
#header { |
||||
text-align: center; |
||||
margin-top: 20px; |
||||
} |
||||
|
||||
</style> |
@ -0,0 +1,4 @@ |
||||
import { createApp } from 'vue' |
||||
import App from './App.vue' |
||||
|
||||
createApp(App).mount('#app') |
@ -0,0 +1,4 @@ |
||||
const { defineConfig } = require('@vue/cli-service') |
||||
module.exports = defineConfig({ |
||||
transpileDependencies: true |
||||
}) |
Loading…
Reference in new issue