This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 需求:el-table高度跟随内容,最高不能超过屏幕剩余高度,超过屏幕剩余高度时出现滚动条,header固定 | |
| 方案: | |
| 容器设置height: 100%;占满屏幕高度,然后display: flex;flex-direction: column; | |
| el-table只需要设置style="width: 100%"即可 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| 1. 声明 watchEffect 后会立即调用传入的回调,无论回调函数中是否存在响应式依赖 | |
| watchEffect(() => { | |
| console.log('watchEffect'); | |
| }) | |
| 立即执行这一次是为了收集响应式依赖,后续收集到的任意一个响应式依赖变化了,都会再次触发这个回调 | |
| 如果没收集到响应式依赖,那么后续就不会再触发回调了 | |
| 2. 传入的回调函数中执行了另一个函数,这个函数中的响应式依赖也可以被收集到 | |
| watchEffect(() => { | |
| otherFn(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| 在vue2.x中@是配置的路径别名,它指向/src | |
| 但它只能使用在<template></template>和<script></script>中使用,在<style></style>中使用会报错。 | |
| 要在<style></style>中使用路径别名,就要在@前面加上~,即使用~@ | |
| .bg-img { | |
| background: url("@/assets/images/logo.png"); 这里会报错需要在@前面加上~ | |
| } | |
| 改成 | |
| .bg-img { | |
| background: url("~@/assets/images/logo.png"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| import 存在于JavaScript中的模块化导入,比如: | |
| import vue from 'vue' | |
| import { debounce } from './tools/common.js' | |
| import './style/reset.css' | |
| @import 存在于样式文件中、或样式标签中,比如: | |
| common.scss 中 @import './abc.scss'; | |
| 样式标签: | |
| <style lang="scss" scoped> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- | |
| 方案1: | |
| <style src="./viewsCss/float.scss" lang="scss" scoped></style> | |
| 方案2: | |
| <style lang="scss" scoped> | |
| @import "./viewsCss/float.scss" | |
| </style> | |
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * | |
| * @desc 判断`obj`是否为空 | |
| * @param {Object} obj | |
| * @return {Boolean} | |
| */ | |
| function isEmptyObject(obj) { | |
| if (!obj || typeof obj !== 'object' || Array.isArray(obj)) | |
| return false | |
| return !Object.keys(obj).length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '/hiapmrolex/hiapm': { | |
| target: 'https://icanal-beta.starling.huawei.com/', | |
| secure: false, | |
| changeOrigin: true, | |
| rewrite: (path) => path.replace(/^\/hiapmrolex/, ''), | |
| } | |
| /* | |
| secure: true, 默认 | |
| "默认情况下,将不接受在 HTTPS 上运行且证书无效的后端服务器" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = function() { | |
| console.log(this); | |
| }; | |
| a() // ===> window | |
| a.call({}) // ===> {} | |
| var b = a.bind({b: 'b'}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| server { | |
| # 其他的省略 | |
| # 应用部署在 xxx.com的子路径hiapmrolex下,用的是history路由模式,所有路由(除了配置的反向代理的路由)都返回index.html | |
| location / { | |
| try_files $uri $uri/ /hiapmrolex/index.html; | |
| } | |
| # try_files 可以解决任意路由 /*/**/* 都能返回指定的index.html 但是,如果任意路由加上.html后缀/*/**/*.html时 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| '/hiapm': { | |
| target: 'https://icanal-beta.starling.huawei.com/', | |
| secure: false, | |
| changeOrigin: true, | |
| }, | |
| '/mateopenapi': { | |
| target: 'https://openapi.gdemate.gamma.tools.huawei.com/', | |
| secure: false, | |
| changeOrigin: true, |