提交 c1121f08 编写于 作者: W weixin_46115723

Thu Mar 6 15:18:00 CST 2025 inscode

上级 c58bd646
<script setup>
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import { provide, reactive } from 'vue'
import { eventBus } from './function/bus/index.js'
const watermark = reactive({
rotate: -30, // 水印的旋转角度, 单位 °,取值范围[-90, 90]
zIndex: -1, // 水印元素的z-index值
image: '', // 水印图片,建议使用 2x 或 3x 图像
content: '测试水印[0123456789]', // 水印文本内容
font: {
color: 'rgba(0, 0, 0, 0.5)', // 字体颜色
fontSize: 20, // 字体大小
fontWeight: 'bold', // 字重 normal
fontFamily: 'Georgia', // 字体 sans-serif
fontStyle: 'normal', // 字体样式 normal
textAlign: 'left', // 文本对齐
textBaseline: 'top', // 文本基线 hanging\alphabetic\middle\bottom\top}
},
gap: [50, 100], // 水印之间的间距[行,纵]
offset: [0, 0], // 水印从容器左上角的偏移 默认值为 gap/2 [top, left]
})
eventBus.on('watermark', (config) => {
Object.keys(watermark).forEach(item => {
watermark[item] = config[item]
})
})
provide('watermark', watermark);
</script>
<template>
<header>
<img alt="Vue logo" class="logo" src="./assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<HelloWorld msg="You did it!" />
<!-- <nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav> -->
</div>
</header>
<RouterView />
</template>
<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
<script setup>
import { RouterLink, RouterView } from 'vue-router'
import HelloWorld from './components/HelloWorld.vue'
import { provide, reactive } from 'vue'
import { eventBus } from '@/function/bus/index.js'
const watermark = reactive({
rotate: -30, // 水印的旋转角度, 单位 °,取值范围[-90, 90]
zIndex: -1, // 水印元素的z-index值
image: '', // 水印图片,建议使用 2x 或 3x 图像
content: '测试水印[0123456789]', // 水印文本内容
font: {
color: 'rgba(0, 0, 0, 0.5)', // 字体颜色
fontSize: 20, // 字体大小
fontWeight: 'bold', // 字重 normal
fontFamily: 'Georgia', // 字体 sans-serif
fontStyle: 'normal', // 字体样式 normal
textAlign: 'left', // 文本对齐
textBaseline: 'top', // 文本基线 hanging\alphabetic\middle\bottom\top}
},
gap: [50, 100], // 水印之间的间距[行,纵]
offset: [0, 0], // 水印从容器左上角的偏移 默认值为 gap/2 [top, left]
})
eventBus.on('watermark', (config) => {
Object.keys(watermark).forEach(item => {
watermark[item] = config[item]
})
})
provide('watermark', watermark);
</script>
<template>
<header>
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
<div class="wrapper">
<HelloWorld msg="You did it!" />
<!-- <nav>
<RouterLink to="/">Home</RouterLink>
<RouterLink to="/about">About</RouterLink>
</nav> -->
</div>
</header>
<RouterView />
</template>
<style scoped>
header {
line-height: 1.5;
max-height: 100vh;
}
.logo {
display: block;
margin: 0 auto 2rem;
}
nav {
width: 100%;
font-size: 12px;
text-align: center;
margin-top: 2rem;
}
nav a.router-link-exact-active {
color: var(--color-text);
}
nav a.router-link-exact-active:hover {
background-color: transparent;
}
nav a {
display: inline-block;
padding: 0 1rem;
border-left: 1px solid var(--color-border);
}
nav a:first-of-type {
border: 0;
}
@media (min-width: 1024px) {
header {
display: flex;
place-items: center;
padding-right: calc(var(--section-gap) / 2);
}
.logo {
margin: 0 2rem 0 0;
}
header .wrapper {
display: flex;
place-items: flex-start;
flex-wrap: wrap;
}
nav {
text-align: left;
margin-left: -1rem;
font-size: 1rem;
padding: 1rem 0;
margin-top: 1rem;
}
}
</style>
// import { defineConfig } from 'vite'
// import vue from '@vitejs/plugin-vue'
// // https://vitejs.dev/config/
// export default defineConfig({
// server: {
// host: true
// },
// plugins: [vue()]
// })
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: true
},
plugins: [vue()]
plugins: [
vue(),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
}
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册