Files
kuboard-press/.vuepress/components/StarGazer.vue
huanqing.shao 0937daa97a 推荐
2019-08-29 08:16:08 +08:00

57 lines
1.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div>
<el-dialog
title="感谢阅读"
:visible.sync="dialogVisible"
width="50%"
:append-to-body ="true">
<span>给一个 github star给一份鼓励</span>
<span slot="footer" class="dialog-footer">
<el-button @click="waitAMoment">一会儿再说</el-button>
<el-button type="primary" @click="gotoStar">够义气现在就去</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import Vue from 'vue'
import 'element-ui/lib/theme-chalk/index.css';
import { Dialog, Button } from 'element-ui';
Vue.component(Dialog.name, Dialog)
Vue.component(Button.name, Button)
export default {
data() {
return {
dialogVisible: false
};
},
mounted () {
this.waitAMoment()
},
methods: {
waitAMoment() {
this.dialogVisible = false
if (localStorage.getItem('stared') === 'true') {
return
}
let _this = this
setTimeout(_ => {
_this.dialogVisible = true
}, 60000 * 3)
},
gotoStar() {
this.dialogVisible = false
window.open('https://github.com/eip-work/kuboard-press')
localStorage.setItem('stared', 'true')
}
}
}
</script>
<style>
</style>