单应用项目,可以创建很多独立工具类页面 ,不用登录 初始化的页面
zhangchen
2025-07-08 071ac82f546e55e6a660a90a815404e5edca7173
ID1825-配置修改
2个文件已添加
8个文件已修改
144 ■■■■■ 已修改文件
package-lock.json 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
postcss.config.js 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.ts 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.ts 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/style.css 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/mobile/bedsideAuxiliaryScreen/index.vue 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/register/index.vue 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/registerSuu/index.vue 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.ts 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json
@@ -25,9 +25,11 @@
        "@vitejs/plugin-vue": "^5.2.1",
        "@vue/compiler-sfc": "^3.5.13",
        "@vue/tsconfig": "^0.7.0",
        "amfe-flexible": "^2.2.1",
        "install": "^0.13.0",
        "less": "^4.2.1",
        "npm": "^11.4.2",
        "postcss-pxtorem": "^6.1.0",
        "typescript": "~5.6.2",
        "vite": "^6.0.5",
        "vue-tsc": "^2.2.0"
@@ -1228,6 +1230,13 @@
      "resolved": "https://registry.npmmirror.com/alien-signals/-/alien-signals-0.4.14.tgz",
      "integrity": "sha512-itUAVzhczTmP2U5yX67xVpsbbOiquusbWVyA9N+sy6+r6YVbFkahXvNCeEPWEOMhwDYwbVbGHFkVL03N9I5g+Q==",
      "dev": true
    },
    "node_modules/amfe-flexible": {
      "version": "2.2.1",
      "resolved": "https://registry.npmjs.org/amfe-flexible/-/amfe-flexible-2.2.1.tgz",
      "integrity": "sha512-L2VfvDzoETBjhRptg5u/IUuzHSuxm22JpSRb404p/TBGeRfwWmmNEbB+TFPIP/sS/+pbM18bCFH9QnMojLuPNw==",
      "dev": true,
      "license": "MIT"
    },
    "node_modules/async-validator": {
      "version": "4.2.5",
@@ -4708,6 +4717,16 @@
        "node": "^10 || ^12 || >=14"
      }
    },
    "node_modules/postcss-pxtorem": {
      "version": "6.1.0",
      "resolved": "https://registry.npmjs.org/postcss-pxtorem/-/postcss-pxtorem-6.1.0.tgz",
      "integrity": "sha512-ROODSNci9ADal3zUcPHOF/K83TiCgNSPXQFSbwyPHNV8ioHIE4SaC+FPOufd8jsr5jV2uIz29v1Uqy1c4ov42g==",
      "dev": true,
      "license": "MIT",
      "peerDependencies": {
        "postcss": "^8.0.0"
      }
    },
    "node_modules/proxy-from-env": {
      "version": "1.1.0",
      "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
@@ -5834,6 +5853,12 @@
      "version": "0.4.14",
      "resolved": "https://registry.npmmirror.com/alien-signals/-/alien-signals-0.4.14.tgz",
      "integrity": "sha512-itUAVzhczTmP2U5yX67xVpsbbOiquusbWVyA9N+sy6+r6YVbFkahXvNCeEPWEOMhwDYwbVbGHFkVL03N9I5g+Q==",
      "dev": true
    },
    "amfe-flexible": {
      "version": "2.2.1",
      "resolved": "https://registry.npmjs.org/amfe-flexible/-/amfe-flexible-2.2.1.tgz",
      "integrity": "sha512-L2VfvDzoETBjhRptg5u/IUuzHSuxm22JpSRb404p/TBGeRfwWmmNEbB+TFPIP/sS/+pbM18bCFH9QnMojLuPNw==",
      "dev": true
    },
    "async-validator": {
@@ -8143,6 +8168,13 @@
        "source-map-js": "^1.2.1"
      }
    },
    "postcss-pxtorem": {
      "version": "6.1.0",
      "resolved": "https://registry.npmjs.org/postcss-pxtorem/-/postcss-pxtorem-6.1.0.tgz",
      "integrity": "sha512-ROODSNci9ADal3zUcPHOF/K83TiCgNSPXQFSbwyPHNV8ioHIE4SaC+FPOufd8jsr5jV2uIz29v1Uqy1c4ov42g==",
      "dev": true,
      "requires": {}
    },
    "proxy-from-env": {
      "version": "1.1.0",
      "resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
package.json
@@ -2,7 +2,6 @@
  "name": "my-project",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "dev:prod": "vite --mode production",
@@ -30,9 +29,11 @@
    "@vitejs/plugin-vue": "^5.2.1",
    "@vue/compiler-sfc": "^3.5.13",
    "@vue/tsconfig": "^0.7.0",
    "amfe-flexible": "^2.2.1",
    "install": "^0.13.0",
    "less": "^4.2.1",
    "npm": "^11.4.2",
    "postcss-pxtorem": "^6.1.0",
    "typescript": "~5.6.2",
    "vite": "^6.0.5",
    "vue-tsc": "^2.2.0"
postcss.config.js
New file
@@ -0,0 +1,24 @@
module.exports = {
  plugins: {
    'postcss-pxtorem': {
      rootValue: 37.5,
      propList: ['*'],
      include: file => {
        if (!file) return false;
        const normalized = file.replace(/\\/g, '/');
        // 只转换 mobile 目录里的样式 OR element-plus 目录里的样式
        // 但 element-plus 样式只在 mobile 目录被引用时才生效,需保证引用范围
        return normalized.includes('/src/views/mobile/') || normalized.includes('/node_modules/element-plus/');
      },
      exclude: file => {
        if (!file) return false;
        const normalized = file.replace(/\\/g, '/');
        // 排除除 element-plus 外的 node_modules,防止无关样式被转
        if (/node_modules/.test(normalized) && !normalized.includes('/node_modules/element-plus/')) {
          return true;
        }
        return false;
      }
    }
  }
}
src/main.ts
@@ -1,3 +1,4 @@
import 'amfe-flexible';
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'   
src/router/index.ts
@@ -6,13 +6,14 @@
import test from '../views/test.vue'; // 搜索结果页,接收查询参数
import registerForNutrition from '../views/register/index.vue'
import registerSuu from '../views/registerSuu/index.vue'
import bedsideAuxiliaryScreen from '../views/mobile/bedsideAuxiliaryScreen/index.vue';
// 定义路由规则,并为每个路由指定类型安全的 props
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'Home',
    component: deviceWindows2,
    component: bedsideAuxiliaryScreen,
  },
  {
    path: '/test',
src/style.css
@@ -1,49 +0,0 @@
:root {
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: light dark;
  color: rgba(255, 255, 255, 0.87);
  background-color: #242424;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
#app {
  width: 100%;
  height: 100%;
  border: 1px rgb(23, 7, 7) solid;
  background-color: lightblue; /* 可选:用于可视化效果 */
}
@media (prefers-color-scheme: light) {
  :root {
    color: #213547;
    background-color: #ffffff;
  }
  a:hover {
    color: #747bff;
  }
  button {
    background-color: #f9f9f9;
  }
}
.el-loading-spinner .el-loading-text {
  font-size: 16px; /* 修改为你需要的字体大小 */
}
.el-dialog {
  padding: 0;
  padding-bottom: 20px;
  border-radius: 10px;
}
src/views/mobile/bedsideAuxiliaryScreen/index.vue
New file
@@ -0,0 +1,20 @@
<template>
    <div class="bedside-auxiliary-screen-container">
        张三
    </div>
</template>
<script lang="ts" setup>
</script>
<style lang="less" scoped>
*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.bedside-auxiliary-screen-container {
    font-size: 48px;
}
</style>
src/views/register/index.vue
@@ -2,7 +2,7 @@
    <div class="register-form">
      <van-image width="100" height="100" :src="logo" />
      <h1>用户注册</h1>
      <p>创建您的账户,开始使用我们的服务</p>
      <p class="desc">创建您的账户,开始使用我们的服务</p>
  
      <van-form @submit="onSubmit">
        <!-- 用户名 -->
@@ -221,4 +221,7 @@
    color: #666;
    margin-bottom: 20px;
  }
  .desc {
    font-size: 14px;
  }
  </style>
src/views/registerSuu/index.vue
@@ -14,4 +14,7 @@
    color: #4caf50;
    margin-bottom: 20px;
  }
p {
  font-size: 14px;
}
  </style>
vite.config.ts
@@ -1,8 +1,12 @@
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';
export default defineConfig({
  plugins: [vue()],
   css: {
    postcss: path.resolve(__dirname, 'postcss.config.js')
  },
  server: {
    port: 3034, // 指定端口号为 3000
    strictPort: true, // 如果端口被占用,则抛出错误而不是尝试下一个可用端口