
Vue
文章平均质量分 54
ygkyufcl
这个作者很懒,什么都没留下…
展开
-
axios-文件下载
@/services/API.js/* 获取远程协助状态 */export function downLoadFiles(url, config) { return get(url, config);}import { downLoadFiles } from '@/services/API.js';export const downLoad = { methods: { downLoad(url) { downLoadFiles(url, { responseTy原创 2021-01-15 15:26:24 · 754 阅读 · 0 评论 -
vue打包-合并chunk
vue.config.jsconst webpack = require("webpack");module.exports = { configureWebpack: { plugins: [ new webpack.optimize.MinChunkSizePlugin({ minChunkSize: 100000 // 通过合并小于 minChunkSize 大小的 chunk,将 chunk 体积保持在指定大小限制以上 }) ] }原创 2020-12-10 11:24:59 · 2548 阅读 · 0 评论 -
解决双重请求数据时,获取到数据,但页面不显示的问题
data(){ return {data:[],FinalData:[]}},async created(){ await getOneData().then(res=>{ this.data=res.data.data; this.getData(); })},methods:{ async getData(){ var data=[]; for(let i=0;i<this.data.length;i++){ await getTwoData().the原创 2020-10-29 17:34:24 · 791 阅读 · 0 评论 -
element-实现表格内修改
一、<el-table-column prop="serial" label="序号" ><template slot-scope="scope"> <span @click.stop="scope.row.showInput = true" style="display: inline-block;width: 100%;" v-if="!scope.row.showInput" >{{ scope.原创 2020-10-29 17:22:45 · 531 阅读 · 0 评论 -
JS实现打印功能
<el-button @click="print" >打印</el-button>tabData:[{log:'123468461354685'}]print(){ //打印 打开新的标签页 点击取消关闭新页面返回当前页面 var openWin=window.open() var str="<table style='color:#333;font-size:12px;' cellspacing='0' cellpadding='5'><原创 2020-10-15 18:44:44 · 353 阅读 · 0 评论 -
vue-实现路由权限(路由动态渲染)
一、layout/components/Sidebar/index.vuecomputed:{ routes() { return this.$store.state.routes;//原本是:this.$router.options.routes; }}二、store/index.jsconst store = new Vuex.Store({ state: { roles: ['admin'], //角色 routes: [] //路由原创 2020-09-22 18:39:01 · 1652 阅读 · 0 评论 -
Vue-高德地图的使用
一、实现根据地图选择位置template<span>{{location}}</span><iframe id="mapContainer" src="https://m.amap.com/picker/?center=116.3972,39.9696&key=608d75903d29ad471362f8c58c550daf"></iframe>scriptdata(){ return{ location:'' }}m原创 2020-09-11 18:41:50 · 801 阅读 · 0 评论 -
Vue—实现文件上传(多文件),图片上传
一、图片上传//template <input type="file" accept="image/*" @change="changeImage()" ref="avatarInput" style="display:none" /> <div原创 2020-07-20 17:55:15 · 3745 阅读 · 0 评论 -
Vue—选择时间区间显示时长
一、template <el-date-picker placeholder="开始时间" v-model="value[0]" type="datetime" > </el-date-picker ><span>至</span>原创 2020-07-20 17:40:44 · 1111 阅读 · 0 评论 -
Vue—将数字转换为大写金额
一、template <el-input type="number" v-enter-number="" v-model="value" placeholder="请输入金额" ></el-input> <p>原创 2020-07-20 17:35:32 · 4360 阅读 · 3 评论 -
Vue—SEO优化
参考:https://blog.youkuaiyun.com/qq_40816649/article/details/92799569一、<meta name="keywords" content="设置关键字" /><meta name="description" content="网站描述信息" /><title>网站标题</title>二、<h1><img alt="网站logo" src="img/logo.png" />&l原创 2020-06-10 16:22:00 · 431 阅读 · 0 评论 -
Vue—实现中英切换
一、src/store/index.jsimport Vue from "vue";import Vuex from "vuex";Vue.use(Vuex);export default new Vuex.Store({ state: { index: 0 }, mutations: { changeIndex(state, payload) { state.index = payload; } }, actions: {}, mod原创 2020-05-26 14:17:51 · 610 阅读 · 0 评论 -
Vue——实现文件上传(单文件)和文件下载
一、文件上传 <el-input v-model="fileName"></el-input> <el-button @click="choseFile" plain ><span class="upLoad iconfont icon-shangchuan"></span >点击上传</el-button > <input原创 2020-05-14 15:31:07 · 849 阅读 · 0 评论 -
Vue——在IE浏览器中白屏的问题
一、template<el-input v-model="fileName"></el-input> <el-button @click="choseFile" plain ><span class="upLoad iconfont icon-shangchuan"></span >点击上传</el-button > <input原创 2020-05-12 19:04:22 · 418 阅读 · 0 评论 -
vue-admin-template中实现点击侧边栏刷新页面
一、@/layout/components/Sidebar/Link.vue<template> <!-- eslint-disable vue/require-component-is --> <component v-bind="linkProps(to)"> <slot /> </component></template><script>import { isExternal } from原创 2020-05-11 14:01:23 · 1634 阅读 · 3 评论 -
Vue——实现组件可拖拽
一、template<div class="item" v-for="(item, index) in items" :key="index" draggable="true" @dragstart="handleDragStart($event, item)" @dragover.preven...原创 2020-04-30 13:45:05 · 1859 阅读 · 0 评论 -
在vue中使用阿里图标库
一、查找需要的图标,加入购物车二、添加至我的项目三、点击生成代码四、下载代码,保存至public/css五、在main.js中引入import "../public/css/font_1739265_wnnyllj4ine.css";六、直接在组件中进行调用<span class="iconfont icon-bfgq-fenjifengxuan"></s...原创 2020-04-07 16:04:20 · 795 阅读 · 1 评论 -
Vue——导出pdf
一、安装依赖项npm i html2canvasnpm i jspdf二、utils/exportPdf.jsimport html2Canvas from 'html2canvas'import JsPDF from 'jspdf'export default{ install (Vue, options) { Vue.prototype.getPdf = funct...原创 2020-03-31 16:14:36 · 218 阅读 · 0 评论 -
Vue——使用媒体查询
在vue中是不能直接使用@media的,我们必须结合less或者sass来使用它一、安装依赖项npm install sass-loader node-sass --save-dev二、public/scss/index.scssbody{ background-color:red; @media only screen and (max-width: 800px) { ...原创 2020-03-30 11:19:44 · 11893 阅读 · 3 评论 -
Vue——导出word文档
一、安装依赖项npm i docxtemplaternpm i jszip-utilsnpm i jszipnpm i file-saver二、public/word.docx三、在组件中进行调用<template> <el-form ref="form" :model="form" label-width="80px"> <el-fo...原创 2020-03-30 10:15:44 · 2368 阅读 · 4 评论 -
Vue——实现导出、导入Excel表格的功能
一、安装依赖项npm install xlsx file-saver -Snpm install script-loader -S -D二、utils/Blob.js(function(view) { "use strict"; view.URL = view.URL || view.webkitURL; if (view.Blob && view.URL...原创 2020-03-30 09:49:54 · 682 阅读 · 0 评论 -
Vue——封装axios请求,请求头携带token、cookie,当请求超时再次发送请求
utils/request.jsimport axios from "axios";const instance = axios.create({ timeout: 8000,//设置网络请求超时时间 baseURL: "http://0.0.0.0:0000" ,//接口的baseUrl headers: { "Content-Type": "application/x-...原创 2020-03-25 09:48:29 · 2272 阅读 · 0 评论 -
Vue中使用CDN的方式引入echarts、axios、Element UI、swiper
原本我所有的插件都是npm安装,然后使用的时候使用import引入的,,,但是在我打包时发现总共没有几个页面可能由于有大量的图表,打包之后20M左右这样肯定是不行的,我就使用按需引入,但还是有17M左右最后我就想起来使用CDN引入了,,果然最终文件大小就27kbhtml.js<link rel="stylesheet" href="https://unpkg.com/elemen...原创 2020-03-24 17:55:24 · 7540 阅读 · 0 评论 -
Vue开发跨域问题
问题1:在开发时由于前后端服务器不一致,涉及到了跨域解决方式:碰到这种事情第一反应是使用chrome上的解决跨域的扩展程序,,,但是仍旧未能获取到数据,,,,然后我以为是扩展程序出错了,就让服务器端将我的IP地址设置为允许获取数据问题2:仍旧未曾获取到数据(但是不会报跨域错误),通过跟服务器端交流得知,需要在请求头携带cookie才能获取到数据,,,于是我便设置了axios.def...原创 2020-03-24 17:29:23 · 116 阅读 · 0 评论