-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aafcab8
commit 5b2e5cf
Showing
7 changed files
with
133 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,50 @@ | ||
# blog-vue | ||
|
||
|
||
## 简介 | ||
|
||
博客基于 GitHub Pages 与 Github API 实现无后台,可动态发布博客的系统 | ||
博客数据储存于gist 通过Github API 进行增删改查 | ||
|
||
### 特点 | ||
|
||
- [x] 基于 GitHub Pages 无需服务器 | ||
- [x] 改进传统 GitHub Pages 不能动态发布的缺陷 | ||
- [x] 使用vue单页面,体验较好 | ||
|
||
### 演示地址 | ||
[https://github-laziji.github.io][1] | ||
|
||
### 快速开始 | ||
不想下载源码编译的同学 可以直接下载打包好的文件 [https://github.com/GitHub-Laziji/GitHub-Laziji.github.io][2] | ||
|
||
## 准备工作 | ||
|
||
### 安装 | ||
|
||
npm install | ||
|
||
### 运行 | ||
|
||
npm run dev | ||
|
||
|
||
### 构建 | ||
|
||
npm run build | ||
|
||
|
||
### 获取Token | ||
|
||
在 *github > settings > Developer settings > Personal access tokens* 勾选gist权限 获取Token | ||
|
||
|
||
------ | ||
|
||
|
||
作者 *Laziji* | ||
|
||
|
||
|
||
[1]: https://github-laziji.github.io | ||
[2]: https://github.com/GitHub-Laziji/GitHub-Laziji.github.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<template> | ||
<div> | ||
<el-card shadow="never" style="min-height: 600px"> | ||
<div slot="header"> | ||
<span>{{blog.title}}</span> | ||
</div> | ||
<div style="font-size: 0.9rem;line-height: 1.5;color: #606c71;"> | ||
发布 {{blog.createTime}}<br> | ||
更新 {{blog.updateTime}} | ||
</div> | ||
<div style="font-size: 1.1rem;line-height: 1.5;color: #303133;border-bottom: 1px solid #E4E7ED;padding: 20px 0px 25px 0px"> | ||
{{blog.description}} | ||
</div> | ||
<div v-html="blog.content"></div> | ||
</el-card> | ||
</div> | ||
</template> | ||
<script> | ||
import GistApi from '@/api/gist' | ||
export default{ | ||
data(){ | ||
return { | ||
loading:false, | ||
blog:{ | ||
id:"", | ||
title:"", | ||
content:"", | ||
description:"", | ||
createTime:"", | ||
updateTime:"" | ||
} | ||
} | ||
}, | ||
mounted(){ | ||
this.loading=true | ||
GistApi.list().then((result)=>{ | ||
if(!result||result.length==0){ | ||
return | ||
} | ||
for(let key in result[0].files){ | ||
this.blog.id=result[0]['id'] | ||
break | ||
} | ||
GistApi.single(this.blog.id).then((result)=>{ | ||
for(let key in result.files){ | ||
this.blog['title']=key | ||
this.blog['content']=this.$markdown(result.files[key]['content']) | ||
this.blog['description']=result['description'] | ||
this.blog['createTime']=this.$util.utcToLocal(result['created_at']) | ||
this.blog['updateTime']=this.$util.utcToLocal(result['updated_at']) | ||
break | ||
} | ||
}).then(()=>this.loading=false) | ||
}) | ||
}, | ||
} | ||
</script> |