一、ES6数组去重结果 :...new set(array)
二、cmd (管理员身份运行) ipconfig/flushdns(刷新dns)(有时某个网站进不去就刷新一下,比如echarts中文官网)
三、检查元素中:快速搜索文件所在位置:浏览器打开 f12 到 network 下ctrl+f- 搜索关键词 -回车。
四、动态设置宽或者高(注意计算符号左右的空格是必要的) height: calc(100vh - 50px);
五、标题左侧渐变(标题左侧渐变高亮色)
.divH6 {
h6 {
display: block;
margin-bottom: 8px;
text-indent: 1.5em;
font-size: 14px;
font-family: '宋体';
color: black;
position: relative;
.h6-left-bgc {
width: 8px;
height: 16px;
position: absolute;
background-image: linear-gradient(
to bottom,
#fd2b0f,
#fcfbfa
); // 背景色渐变
}
}
}
六、搜索的词语红色高亮:
html中: <span v-html="redWords(item.name+' '+ item.code)"></span>
js中:
methods: {
redWords (text) { // 搜索匹配的词高亮
if (text) {
const reg = new RegExp(this.attrs.lineValue, 'gi') // 动态正则表达式 :匹配传入的搜索值不区分大小写 i表示不区分大小写,g表示全局搜索
return text.replace(reg, `<span class="custom-title">${this.attrs.lineValue}</span>`) // 使用replace替换
}
}
}
七、不显示 Tabbar 的路由名称:
<van-tabbar route v-if="!['login','404','loginfailed'].includes($route.name)" </van-tabbar>
八、前置路由守卫登录权限判断逻辑:
九、vue3使用echarts:
main.js 文件内代码:
1、import Echarts from 'vue-echarts'
2、createApp(App) .component('Echarts',Echarts).mount('#app')
.vue组件中代码:
<echarts id="chart" :option="option8" /> (需要宽高)
十、
关于npm 打开项目报错若
1-下载依赖包清缓存指令 npm cache clean --force npm i ...(有or的选项里拼接第二条试试)--legacy-peer-deps
--legacy-peer-deps标志是在v7中引入的,目的是绕过peerDependency自动安装;它告诉 NPM 忽略项目中引入的各个modules
之间的相同modules但不同版本的问题并继续安装,保证各个引入的依赖之间对自身所使用的不同版本modules共存。