【add】水印
This commit is contained in:
+32
-1
@@ -2,6 +2,7 @@
|
||||
<a-config-provider :locale="locale">
|
||||
<div id="app">
|
||||
<router-view v-if="isRouterAlive"/>
|
||||
<div class="watermark" v-if="show" v-watermark="{text: watermark, textColor: 'rgba(180, 180, 180, 0.2)'}"></div>
|
||||
</div>
|
||||
</a-config-provider>
|
||||
</template>
|
||||
@@ -11,6 +12,8 @@ import enUS from 'ant-design-vue/lib/locale-provider/en_US'
|
||||
import enquireScreen from '@/utils/device'
|
||||
import moment from 'moment'
|
||||
import 'moment/locale/zh-cn'
|
||||
// 水印功能
|
||||
import '@/utils/warterMark'
|
||||
|
||||
moment.locale('zh-cn')
|
||||
|
||||
@@ -21,7 +24,26 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
locale: zhCN,
|
||||
isRouterAlive: true
|
||||
isRouterAlive: true,
|
||||
show: true
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
watermark () {
|
||||
if (this.$store.getters.userInfo) {
|
||||
return this.$store.getters.userInfo.username + this.$store.getters.userInfo.realname
|
||||
}
|
||||
return null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
watermark () {
|
||||
setTimeout(() => {
|
||||
this.show = false
|
||||
this.$nextTick(() => {
|
||||
this.show = true
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@@ -76,4 +98,13 @@ export default {
|
||||
#app {
|
||||
height: 100%;
|
||||
}
|
||||
.watermark {
|
||||
pointer-events: none;
|
||||
position: fixed;
|
||||
z-index: 999999999;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user