防抖和节流
摘要:防抖 当事件被触发时,设定一个周期延迟执行动作,若期间又被触发,则重新设定周期,直到周期结束,执行动作 function debounce(func, delay) { let timer = null; return function (...arguments) { clearTimeout(t
阅读全文
VUE配置proxy代理、开发环境、测试环境、生产环境
摘要:VUE配置proxy代理、开发环境、测试环境、生产环境 前端开发过程中,我们经常会碰到跨域的问题,下面我们来配置下,不同的环境下,统一的跨域问题解决。 1、根目录下新建三个环境的配置文件,.env.development(开发环境).env.test(测试环境).evn.production(生产环
阅读全文
Vue 3 + vite 2.0 动态图片地址
摘要:const path = new URL(`../assets/blogPhotos/${name}.jpg`, import.meta.url); Vue 3使用vite 2.0 动态引入加载图片
阅读全文
vue 重置 data
摘要:Object.assign(this.$data, this.$options.data()) this.message = this.$options.data().message
阅读全文
Element Select 二次封装
摘要:<script> import { Select, Option } from 'element-ui' export default { props: { options: { type: Array, default: () => [], }, value: {}, }, render(h) {
阅读全文
js rand(min, max)
摘要:rand(min, max) { return parseInt(Math.random() * (max - min + 1) + min, 10); },
阅读全文
vue amap
摘要:index.html <head> ... <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.15&key=xxxxxx"></script> </head> vue.config.js module.exp
阅读全文
vue validate js
摘要:export default class Validator { static required(val, msg) { if ((!val && val != 0) || val.length 0) { throw msg } return this } static mobile(val) {
阅读全文
h5 video
摘要:<div class="relative"> <video class="w-full h-full object-fill" id="ckplayer_a1" :src="url" x5-video-player-type="h5" preload="metadata" playsinline="
阅读全文
vue api 父类
摘要:import axios from './axios' export default class Base { constructor() {} post(url, data) { return new Promise((resolve, reject) => { axios .post(url,
阅读全文
vue-cli 部署到子目录
摘要:生产环境打包到子目录 nginx 配置子目录路径
阅读全文
tailwiind init
摘要:1. init npm init -y npm install tailwindcss postcss-cli autoprefixer @fullhuman/postcss-purgecss -D npx tailwind init 2. postcss.config.js const purge
阅读全文
vue global filters
摘要://main.js //filters.js
阅读全文
Vue - Share variable with slot
摘要:https://stackoverflow.com/questions/47094482/vue-share-variable-with-slot
阅读全文
vue use bulma
摘要:npm install bulma npm install node-sass npm install sass-loader
阅读全文
user login flow
摘要:用户进入app,判断本地是否有用户信息。 有,调用api/refresh,判断是否需要重新登录。 不需要(连续登录),将信息保存在vuex中,并进入首页,往后数据读取全部走vuex。 需要(长时间未登录),删除本地用户信息并跳转到登录流程。 没有, 跳转到登录流程(以下是登录流程)。 调用api/l
阅读全文
访问虚拟机中的 vue-cli 项目
摘要:修改 Z:\vue-client\config\index.js 在主机页面访问 此地址 + 端口
阅读全文