随笔分类 -  Vue

摘要:安装 js-pinyin 安装 underscore.js // 分组排序 groupBySort(list) { const groupObj = _.groupBy(list, function(item) { return String(pinyin.getFullChars(item.cou 阅读全文
posted @ 2022-02-16 12:17 coffeemil 阅读(112) 评论(0) 推荐(0)
摘要:debounce.js import Vue from "vue" Vue.directive("debounce", { inserted: function (el, binding) { let timer el.addEventListener('click', () => { if (ti 阅读全文
posted @ 2021-11-15 14:53 coffeemil 阅读(114) 评论(0) 推荐(0)
摘要:main.js Vue.config.productionTip=false 关闭生产模式下给出的提示 阅读全文
posted @ 2021-11-15 10:17 coffeemil 阅读(710) 评论(0) 推荐(0)
摘要:缓存问题,使用指令清理缓存即可 npm cache clean --force 阅读全文
posted @ 2021-10-15 23:35 coffeemil 阅读(357) 评论(0) 推荐(0)
摘要:不影响代码运行1. 问题:Vue运行项目时,控制台报 [WDS] Disconnected!不影响代码运行。 2. 解决方法:将config文件夹下的index.js中的host: '0.0.0.0',改为host: '127.0.0.1',重新启动,刷新页面或者重新启动即可 3. 解释:因为用了全 阅读全文
posted @ 2021-08-03 17:29 coffeemil 阅读(487) 评论(0) 推荐(0)
摘要:首先 sockjs-node 是一个JavaScript库,提供跨浏览器JavaScript的API,创建了一个低延迟、全双工的浏览器和web服务器之间通信通道。 服务端:sockjs-node(https://github.com/sockjs/sockjs-node)客户端:sockjs-cli 阅读全文
posted @ 2021-07-27 19:24 coffeemil 阅读(821) 评论(0) 推荐(0)
摘要:public 下的资源不会经过 webpack 解析处理,准确的说应该是直接给你放进最后的 dist 目录下。项目使用应该是 %public% 这种形式 asset 目录下的会经过 webpack 的 loader 解析,应该是 url-loader,这个 loader 加载完图片后会把一下小的图片 阅读全文
posted @ 2021-07-18 01:02 coffeemil 阅读(281) 评论(0) 推荐(0)
摘要:1.安装依赖 npm i -S file-saver xlsx 2. 添加js文件 utils/Export2Excel.js import fs from 'file-saver' import XLSX from 'xlsx' export default (json, fields, file 阅读全文
posted @ 2021-07-08 01:03 coffeemil 阅读(212) 评论(0) 推荐(0)
摘要:1.vue.config.js module.exports={ lintOnSave = false } 2. 使用指令 vue ui 进入ui界面关掉 阅读全文
posted @ 2021-07-08 00:56 coffeemil 阅读(395) 评论(0) 推荐(0)
摘要:this.$set(this.dsPolicyInfo, 'conditions', text) 阅读全文
posted @ 2021-06-22 17:42 coffeemil 阅读(208) 评论(0) 推荐(0)
摘要://浏览器种显示源码 打开 config/index.js 并找到 devtool property。将其更新为: 如果你使用的是 Vue CLI 2,请设置并更新 config/index.js 内的 devtool property: devtool: 'source-map', 如果你使用的是 阅读全文
posted @ 2021-06-08 20:25 coffeemil 阅读(210) 评论(0) 推荐(0)
摘要:App.vue //cache缓存永久缓存的变量 <script> export default { name: "App", created() { this.persisted(); }, methods: {//持久化 persisted() { if (sessionStorage.getI 阅读全文
posted @ 2021-06-08 01:54 coffeemil 阅读(91) 评论(0) 推荐(0)
摘要:store/modules/cache.js import { listData } from '@/api/system/dict/data.js' const state = { dictCache: {}, } const mutations = { UPDATE_DICTS(state, p 阅读全文
posted @ 2021-06-08 01:24 coffeemil 阅读(959) 评论(0) 推荐(0)
摘要:1.设置淘宝镜像 npm config set registry http://registry.npm.taobao.org/ 还原npm镜像 npm config set registry https://registry.npmjs.org/ 阅读全文
posted @ 2021-06-06 17:16 coffeemil 阅读(58) 评论(0) 推荐(0)
摘要:[vue-pdf] npm连接:https://www.npmjs.com/package/vue-pdf 安装vue-pdf npm i vue-pdf 1.解决字体问题 将node_modules/pdfjs-dist/cmaps文件夹复制到public文件夹下 (找不到的可以看下代码怎么写的, 阅读全文
posted @ 2021-05-16 04:39 coffeemil 阅读(941) 评论(0) 推荐(0)
摘要:vue中的computed无法直接像methos一样传参,但我们可以使用利用闭包 computed:{ getDisabled(){ return (row)=>{ return row.id=1 } } } 阅读全文
posted @ 2021-04-10 23:16 coffeemil 阅读(500) 评论(0) 推荐(0)
摘要:v-mode l等价于 :value 加 @input //父组件<template> <div id="app"> <Son v-model="str" /> {{str}} </div> </template> <script> import Son from "./components/son 阅读全文
posted @ 2021-03-31 03:36 coffeemil 阅读(355) 评论(0) 推荐(0)
摘要:v-bind 和 v-model 连用的妙用 实现checkbox全选,取消全选 <template> <div> 全选<input type="checkbox" v-model="all" /> <br /> <ul> <li v-for="item in list" :key="item.id 阅读全文
posted @ 2021-03-31 03:17 coffeemil 阅读(315) 评论(0) 推荐(0)
摘要:两种获取地址参数方法 //query方式this.$route.query.变量//动态路由方式this.$route.params.变量 编程式导航 跳转传参 this.$router.push({ path:'', //可手写地址 name:'' //name需要在路由上面配置name属性才可以 阅读全文
posted @ 2021-03-28 19:43 coffeemil 阅读(136) 评论(0) 推荐(0)
摘要://history.pushState附加哈希值并不会触发onhashchange var newHash = 'test'; history.replaceState(null, null, window.location.pathname + '#' + newHash); Hash模式底层思想 阅读全文
posted @ 2021-03-27 05:15 coffeemil 阅读(155) 评论(0) 推荐(0)