Skip to content

Commit

Permalink
增加版本检查
Browse files Browse the repository at this point in the history
  • Loading branch information
xiandanin committed Sep 25, 2019
1 parent 73697a7 commit 332a1c3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "github-tags",
"version": "1.0.0",
"version": "1.1.3",
"description": "A Vue.js web extension",
"author": "denghaha <denghahae@qq.com>",
"scripts": {
Expand Down
21 changes: 17 additions & 4 deletions plugin/src/popup/router/pages/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
<button type="button" class="btn btn-outline-primary btn-sm" @click="handleSaveToken">保存</button>
</div>
</div>
<div id="update_container" style="display: none">
<hr />
<div style="font-size: 14px;color: black">有新版本 <a id="update_version" target="_blank"></a></div>
<div id="update_message" style="color: #6f7180"></div>
<div v-if="updateInfo" class="border-top mt-2 pt-2">
<div style="font-size: 14px;color: black">
有新版本 <a :href="updateInfo.link" target="_blank">{{ updateInfo.version }}</a>
</div>
<div style="color: #6f7180">{{ updateInfo.message }}</div>
</div>
</div>
</template>
Expand All @@ -41,6 +42,7 @@ export default {
userInfo: {
token: null,
},
updateInfo: null,
};
},
methods: {
Expand Down Expand Up @@ -75,8 +77,19 @@ export default {
message: message,
});
},
checkUpdate() {
axios
.get('https://raw.githubusercontent.com/dengyuhan/github-tags/master/update.json')
.then(rsp => {
this.updateInfo = rsp.data;
})
.catch(error => {
console.error(new Date(), error);
});
},
},
mounted() {
this.checkUpdate();
let that = this;
chrome.storage.sync.get('user', function(rsp) {
if (rsp && rsp.user && rsp.user.token) {
Expand Down

0 comments on commit 332a1c3

Please sign in to comment.