随笔分类 -  vue

防抖和节流
摘要:防抖 当事件被触发时,设定一个周期延迟执行动作,若期间又被触发,则重新设定周期,直到周期结束,执行动作 function debounce(func, delay) { let timer = null; return function (...arguments) { clearTimeout(t 阅读全文
posted @ 2022-04-26 11:59 jzfan
VUE配置proxy代理、开发环境、测试环境、生产环境
摘要:VUE配置proxy代理、开发环境、测试环境、生产环境 前端开发过程中,我们经常会碰到跨域的问题,下面我们来配置下,不同的环境下,统一的跨域问题解决。 1、根目录下新建三个环境的配置文件,.env.development(开发环境).env.test(测试环境).evn.production(生产环 阅读全文
posted @ 2022-04-26 10:40 jzfan
Vue 3 + vite 2.0 动态图片地址
摘要:const path = new URL(`../assets/blogPhotos/${name}.jpg`, import.meta.url); Vue 3使用vite 2.0 动态引入加载图片 阅读全文
posted @ 2021-08-24 17:00 jzfan
vue 重置 data
摘要:Object.assign(this.$data, this.$options.data()) this.message = this.$options.data().message 阅读全文
posted @ 2021-02-01 09:57 jzfan
Element Select 二次封装
摘要:<script> import { Select, Option } from 'element-ui' export default { props: { options: { type: Array, default: () => [], }, value: {}, }, render(h) { 阅读全文
posted @ 2021-01-26 09:28 jzfan
js rand(min, max)
摘要:rand(min, max) { return parseInt(Math.random() * (max - min + 1) + min, 10); }, 阅读全文
posted @ 2020-07-01 10:19 jzfan
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 阅读全文
posted @ 2020-06-30 16:10 jzfan
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) { 阅读全文
posted @ 2020-06-05 20:48 jzfan
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=" 阅读全文
posted @ 2020-04-27 21:11 jzfan
vue api 父类
摘要:import axios from './axios' export default class Base { constructor() {} post(url, data) { return new Promise((resolve, reject) => { axios .post(url, 阅读全文
posted @ 2020-03-10 16:22 jzfan
vue-cli 部署到子目录
摘要:生产环境打包到子目录 nginx 配置子目录路径 阅读全文
posted @ 2020-01-10 23:38 jzfan
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 阅读全文
posted @ 2019-08-25 15:07 jzfan
vue global filters
摘要://main.js //filters.js 阅读全文
posted @ 2019-08-22 10:26 jzfan
Vue - Share variable with slot
摘要:https://stackoverflow.com/questions/47094482/vue-share-variable-with-slot 阅读全文
posted @ 2018-05-08 16:44 jzfan
vue use bulma
摘要:npm install bulma npm install node-sass npm install sass-loader 阅读全文
posted @ 2018-03-23 11:54 jzfan
user login flow
摘要:用户进入app,判断本地是否有用户信息。 有,调用api/refresh,判断是否需要重新登录。 不需要(连续登录),将信息保存在vuex中,并进入首页,往后数据读取全部走vuex。 需要(长时间未登录),删除本地用户信息并跳转到登录流程。 没有, 跳转到登录流程(以下是登录流程)。 调用api/l 阅读全文
posted @ 2018-01-16 14:22 jzfan
访问虚拟机中的 vue-cli 项目
摘要:修改 Z:\vue-client\config\index.js 在主机页面访问 此地址 + 端口 阅读全文
posted @ 2017-12-26 15:23 jzfan
vue http form post
摘要:vue http form post 阅读全文
posted @ 2017-01-14 11:52 jzfan