feat: 添加移动端页面组件和图片资源
This commit is contained in:
@ -12,7 +12,7 @@ export default defineNuxtConfig({
|
||||
debug: process.env.NODE_ENV === 'development', // 开启详细调试日志
|
||||
|
||||
ssr: true,
|
||||
modules: ['@unocss/nuxt', '@pinia/nuxt', '@element-plus/nuxt', 'pinia-plugin-persistedstate/nuxt'],
|
||||
modules: ['@unocss/nuxt', '@pinia/nuxt', '@element-plus/nuxt', 'pinia-plugin-persistedstate/nuxt','@vant/nuxt'],
|
||||
unocss: {
|
||||
nuxtLayers: true,
|
||||
},
|
||||
@ -30,6 +30,19 @@ export default defineNuxtConfig({
|
||||
},
|
||||
postcss: {
|
||||
plugins: [
|
||||
// 将 rpx 单位仅在移动端样式中转换为 px(在 px->vw 之前)
|
||||
{
|
||||
postcssPlugin: 'rpx-to-px-mobile-only',
|
||||
Declaration(decl) {
|
||||
const file = decl.source && decl.source.input && decl.source.input.file
|
||||
if (!file) return
|
||||
const normalized = file.replace(/\\/g, '/');
|
||||
if (!/\/pages\/mobile\//.test(normalized)) return
|
||||
if (typeof decl.value === 'string' && decl.value.includes('rpx')) {
|
||||
decl.value = decl.value.replace(/(-?\d*\.?\d+)rpx/g, (_, n) => `${n}px`)
|
||||
}
|
||||
},
|
||||
},
|
||||
postcsspxtoviewport({
|
||||
unitToConvert: 'px',
|
||||
viewportWidth: 750,
|
||||
|
||||
Reference in New Issue
Block a user