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 332a1c3 commit a02ae7f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugin/src/popup/router/pages/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
</div>
</div>
</template>

å
<script>
import axios from 'axios';
import config from '../../../../package.json';
export default {
data() {
Expand Down Expand Up @@ -81,7 +82,13 @@ export default {
axios
.get('https://raw.githubusercontent.com/dengyuhan/github-tags/master/update.json')
.then(rsp => {
this.updateInfo = rsp.data;
if (rsp.data && rsp.data.version) {
let ver = parseInt(rsp.data.version.replace(new RegExp(/\./, 'g'), ''));
let c_ver = parseInt(config.version.replace(new RegExp(/\./, 'g'), ''));
if (ver > c_ver) {
this.updateInfo = rsp.data;
}
}
})
.catch(error => {
console.error(new Date(), error);
Expand Down

0 comments on commit a02ae7f

Please sign in to comment.