소스 검색

添加背景水印

lm 1 개월 전
부모
커밋
ea69a21df5
1개의 변경된 파일과 12개의 추가작업 그리고 2개의 파일을 삭제
  1. 12 2
      src/layout/index.vue

+ 12 - 2
src/layout/index.vue

@@ -1,13 +1,16 @@
 <template>
   <div class="layout">
     <Header :horizontalNavList="[]"></Header>
-    <AppMain :menuItems="menuList"/>
+    <el-watermark :font="font" :content="[waterText]" :z-index="9999">
+      <AppMain :menuItems="menuList"/>
+    </el-watermark>
+
   </div>
 </template>
 
 <!-- vue3 setup -->
 <script setup lang="ts">
-import {computed,ref} from 'vue'
+import {computed,ref,reactive,} from 'vue'
 import { useStore } from 'vuex'
 import { useRoute } from 'vue-router'
 import Header from './components/header.vue'
@@ -25,4 +28,11 @@ const menuList =  computed(()=>{
 })
 
 
+const font = reactive({
+  color: 'rgba(0, 0, 0, 0.08)',
+})
+const waterText = computed(()=>{
+  let userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')
+  return userInfo.username + ' ' + userInfo.phoneNo
+})
 </script>