更改UI
This commit is contained in:
@@ -3,6 +3,23 @@ import AutoImport from 'unplugin-auto-import/vite';
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import path from 'path';
|
||||
|
||||
|
||||
// 新落地页移动端样式按 375 设计稿写 px,这里统一转 rem(根字号见 main.js:width/7.5,375 宽时 1rem=50px)
|
||||
const landingPx2Rem = () => ({
|
||||
postcssPlugin: 'landing-hg2-px2rem',
|
||||
Declaration(decl) {
|
||||
const file = (decl.source && decl.source.input && decl.source.input.file) || ''
|
||||
if (!file.includes('landing-hg2/Mobile.vue')) return
|
||||
if (!/\d*\.?\d+px/.test(decl.value)) return
|
||||
decl.value = decl.value.replace(/(-?\d*\.?\d+)px/g, (m, n) => {
|
||||
const v = parseFloat(n)
|
||||
if (!v || Math.abs(v) < 0.5) return m
|
||||
return +(v / 50).toFixed(5) + 'rem'
|
||||
})
|
||||
},
|
||||
})
|
||||
landingPx2Rem.postcss = true
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [vue(),AutoImport({
|
||||
imports: [
|
||||
@@ -10,6 +27,11 @@ export default defineConfig({
|
||||
'vue-router',
|
||||
],
|
||||
})],
|
||||
css: {
|
||||
postcss: {
|
||||
plugins: [landingPx2Rem()],
|
||||
},
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'~': path.resolve(__dirname, 'src'),
|
||||
|
||||
Reference in New Issue
Block a user