随笔分类 - Vue
摘要:history/hash 模式: 有 # 号的就是 hash 模式:它规定 # 号后边的都算 hash 值。hash 值不会作为路径的一部分发给服务器。这个是有好处的,假如你是 history 模式的话,因为路由跳转是不走网络请求的吗,但是你一跳转,url 就变,到时候你再一刷新,这些 url 都带
阅读全文
摘要:开发环境与生产环境下切换 baseURL 增加.env.development文件 // NODE_ENV = 'development' // 一般的人可能会配这个,其实这根本就不是啥配置项,只是对读者的一个说明,可以不用写。因为 Vue 是根据`.env.development`文件名来判断这下
阅读全文
摘要:https://www.jb51.net/article/261289.htm
阅读全文
摘要:https://blog.csdn.net/crystal_iwwish/article/details/122077824
阅读全文
摘要:Vue2 中使用 tailwindcss npm i tailwindcss@3 postcss@8 autoprefixer@10 -D npx tailwindcss init -p // tailwind.config.js /** @type {import('tailwindcss').C
阅读全文
摘要:Vue 想要样式穿透,就得在 style 中加上 scope 不能往组件根节点加样式穿透,会失效 统一一下,Vue3 中统一用 :deep(xxx) 在 Vue2 中,sass 用 ::v-deep;less 用 /deep/ 相关链接: https://vue-loader.vuejs.org/z
阅读全文
摘要:Vue-router 中的 / 与 * const routes = [ { path: '/', // 是指 localhost:8080/ redirect: '/index', component: () => import('@/layouts') }, { path: '*', // 是指
阅读全文
摘要:Vue.config.js 配置项 publicPath 打包后的路径,默认值是 './' outputDir 打包后文件的名称 assetsDir 把项目的静态资源都放进这个目录,写个目录名就可以了,它是相对于 outputDir 的目录 (挺好用,不然它会把 css 等文件就放在 /dist 目
阅读全文
摘要:Vue2 的生命周期 Vue3 的生命周期 注意 切换路由是会重新执行mounted钩子的,除非有keep-alive,已验
阅读全文
摘要:Vue 中的样式动态绑定 废话不多说,反正就这些写法(不要只关注 class 的动态绑定,当 style 有多个样式时,用逗号隔开) <div :style="`background: url(${background1})`"> <div :style="{background: color ''
阅读全文
摘要:slot 插槽 一、使用背景 一般在封装组件的时候,我们会用到插槽 二、插槽类型 1、默认插槽 <div class="container"> <son> <h1>你好啊</h1> </son> </div> <div class="son"> <slot /> </div> 在没有使用插槽的情况下
阅读全文