ToB企服应用市场:ToB评测及商务社交产业平台

标题: H5移动端常见问题 [打印本页]

作者: 慢吞云雾缓吐愁    时间: 2022-8-9 14:44
标题: H5移动端常见问题
样式问题

1、滚动条不能拖动

2、父组件修改子组件样式失败: 因为有 scoped 属性, 所以在子组件的 class 类名前添加 ::v-deep。

3、animation 动画效果:

4、a标签跳转锚点问题 (prerender-spa-plugin优化情况下)

5、div 自身偏移: 使用相对定位。

6、过渡动画 transition: all .5s ease-in .1s;

7、iphone13 pro 底部黑线遮挡问题

8、1px和0.5px的问题(现代手机一般不会有这个问题)

9、animation 逐帧动画最后一帧闪烁?

10、display: flex; 设置宽高生效需要添加两个属性

11、iphone 使用a标签锚点不会跳转

11、position: fixed; top: 0;竟然跟顶部还有距离,上下滚动的时候图直接穿透了

12、苹果手机字体粗细设置失败(需要设置苹果字体)

13、粘性布局 position: sticky; top:50px;

14、requestAnimationFrame(function(){});

vue

1、插件安装。更改页签头部内容。

2、安装插件等比例放大(rem)。

3、使用vantUI,插件嵌套使用方式。

4、首屏优化 SEO 优化,白屏优化。

5、package.json
  1. {
  2.   "name": "hello-world",
  3.   "version": "0.1.0",
  4.   "private": true,
  5.   "scripts": {
  6.     "serve": "vue-cli-service serve",
  7.     "build:prod": "vue-cli-service build",
  8.     "build:dev": "vue-cli-service build --mode development",
  9.     "lint": "vue-cli-service lint"
  10.   },
  11.   "dependencies": {
  12.     "amfe-flexible": "^2.2.1",
  13.     "axios": "^0.27.2",
  14.     "babel-plugin-import": "^1.13.0",
  15.     "core-js": "^3.6.5",
  16.     "fastclick": "^1.0.6",
  17.     "less": "^3.12.2",
  18.     "less-loader": "^6.2.0",
  19.     "postcss-pxtorem": "^5.1.1",
  20.     "prerender-spa-plugin": "^3.4.0",
  21.     "puppeteer": "^5.2.1",
  22.     "shortid": "^2.2.15",
  23.     "vant": "^2.9.3",
  24.     "vue": "^2.6.11",
  25.     "vue-router": "^3.3.4",
  26.     "vue-wechat-title": "^2.0.7"
  27.   },
  28.   "devDependencies": {
  29.     "@vue/cli-plugin-babel": "~4.4.0",
  30.     "@vue/cli-plugin-eslint": "~4.4.0",
  31.     "@vue/cli-service": "~4.4.0",
  32.     "babel-eslint": "^10.1.0",
  33.     "eslint": "^6.7.2",
  34.     "eslint-plugin-vue": "^6.2.2",
  35.     "svg-sprite-loader": "^5.0.0",
  36.     "vite-plugin-style-import": "^1.4.1",
  37.     "vue-template-compiler": "^2.6.11"
  38.   },
  39.   "eslintConfig": {
  40.     "root": true,
  41.     "env": {
  42.       "node": true
  43.     },
  44.     "extends": [
  45.       "plugin:vue/essential",
  46.       "eslint:recommended"
  47.     ],
  48.     "parserOptions": {
  49.       "parser": "babel-eslint"
  50.     },
  51.     "rules": {}
  52.   },
  53.   "postcss": {
  54.     "plugins": {
  55.       "autoprefixer": {}
  56.     }
  57.   },
  58.   "browserslist": [
  59.     "> 1%",
  60.     "last 2 versions",
  61.     "not dead"
  62.   ]
  63. }
复制代码
6、vue.config.js

[code]const PrerenderSPAPlugin = require("prerender-spa-plugin");// eslint-disable-next-line no-unused-varsconst Renderer = PrerenderSPAPlugin.PuppeteerRenderer;const path = require("path");// 将传入的相对路径转换为绝对路径function resolvePath(dir) {  return path.join(__dirname, dir);}const autoprefixer = require("autoprefixer");const pxtorem = require("postcss-pxtorem");module.exports = {  outputDir: "dist",  publicPath: "/",  // publicPath: "/official-h5/",  // outputDir: 'dist/official-h5/',  configureWebpack: () => {    if (process.env.NODE_ENV !== "production") return;    let plugins = [];    plugins.push(      new PrerenderSPAPlugin({        // 生成文件的路径,也可以与webpakc打包的一致。        // 下面这句话非常重要!!!        // 这个目录只能有一级,如果目录层次大于一级,在生成的时候不会有任何错误提示,在预渲染的时候只会卡着不动。        staticDir: path.join(__dirname, "dist"),        // indexPath: path.join(__dirname, 'dist/official-h5/index.html'),        // outputDir: path.join(__dirname, './'),        // 对应自己的路由文件,比如a有参数,就需要写成 /a/param1。        // routes: [        //   "/official-h5",        //   "/official-h5/about",        //   "/official-h5/wisdom-city-solution",        //   "/official-h5/wisdom-env-solution",        //   "/official-h5/wisdom-water-solution",        //   "/official-h5/wisdom-park-solution",        //   "/official-h5/wisdom-env-product",        //   "/official-h5/wisdom-water-product",        //   "/official-h5/wisdom-park-product",        //   "/official-h5/careers"        // ],        // 对应自己的路由文件,比如a有参数,就需要写成 /a/param1。        routes: [          "/",          "/about",          "/news-content",          "/productSmartWater",          "/productSmartZeroCarbon"        ],        // 这个很重要,如果没有配置这段,也不会进行预编译        renderer: new Renderer({          // inject: {          //   foo: "bar"          // },          // headless: false,          // 在 main.js 中 document.dispatchEvent(new Event('render-event')),两者的事件名称要对应上。          renderAfterDocumentEvent: "render-event",          // headless: true,          // inject: {}        }),        // postProcess(renderedRoute) {        //   renderedRoute.html = renderedRoute.html        //     .replace(        //       /()/gi,        //       `$1/official-h5/$2$3`        //     )        //     .replace(        //       /(




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4