| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <template>
- <div id="app" class="bgcolor">
- <router-view />
- </div>
- </template>
- <script>
- import watermark from 'watermark-dom';
- export default {
- name: 'App',
- created() {
- // 当前设备:PC/mobile
- let isDevice = window.navigator.userAgent.match(
- /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
- );
- localStorage.setItem('isDevice', !isDevice ? 'PC' : 'mobile'); // !isDevice: true:PC false:mobile
- },
- mounted() {
- setTimeout(() => {
- let username = localStorage.getItem('nickName');
- if (username) {
- let now = new Date();
- let year = now.getFullYear();
- let month = now.getMonth() + 1;
- let day = now.getDate();
- month = month < 10 ? '0' + month : month;
- day = day < 10 ? '0' + day : day;
- let date = year + '-' + month + '-' + day;
- watermark.load({
- watermark_txt: username + '@立邦' + date,
- watermark_fontsize: '13px',
- watermark_width: 100,
- watermark_rows: 0,
- watermark_cols: 3,
- watermark_height: 50,
- watermark_x_space: 10,
- watermark_y_space: 60,
- watermark_alpha: 0.1,
- });
- }
- }, 1000);
- },
- methods: {},
- };
- </script>
|