- 博客(7)
- 收藏
- 关注
原创 vue 取某个对象的值时提示 Cannot read property '0' of undefined解决
看这张图,浪费了我快半个小时,查看所有数据,打断点,折腾了好久才发现问题所在。MD页面明明渲染正常,但是这个错误一直存在,重启也是这样。先说结论:解决办法是渲染时对每层数据进行判断以下是报错代码:html代码: <h1> <div ...
2019-08-19 23:53:31 7529
原创 vue中循环列表点击每一项显示绑定的不同模块
需求:我需要点击每一项,来显示其对应的模块,隐藏其他循环项的模块解决:注意,还有其他更简单的方法,我这里写的只是针对我场景来的。vue: <div @click="joinGroupChart">加入群聊</div> <ul v-for="(item, index) in resulist" :key="index" ...
2019-08-16 23:03:54 1836
原创 vue 在html使用相对路径无法查看图片
问题:当图片无法显示时,在浏览器控制台中查看图片的url,如:<img data-v-5f28ad28="" src="./img/b-logo.jpg">但鼠标悬浮在src上会显示如下:src="http://localhost:8080/img/b-logo.jpg"解决:将图片放到根目录下的static文件夹下,在vue的webpack配置中可以看...
2019-08-10 12:59:34 1748
原创 vue+axios+express+multer 在express使用multer上传和下载图片
1. 安装-----node中npm install multer –save2. 引入,还需要引入node中原生的2个模块(无需安装)-----node中var multer = require('multer');let fs = require("fs");let path = require("path");3. 写接口-----node中//上传接口...
2019-08-09 00:14:13 1068
原创 vue 中如何使用html2canvas将DOM转化为图片
1.安装依赖:npminstallhtml2canvas--save2.在vue文件中引入<script>import html2canvas from "html2canvas";3.在html中定义要转换的dom片段,及要图片要挂载的位置<Button type="primary" @click="changeImage">保...
2019-08-08 22:20:07 1093
原创 html2canvas使用中报 Error: Element is not attached to a Document
需要注意的是:绘图要选择的dom元素必须是原生元素,不能使用ui库元素,如用iview中的< Content >就会报错。Error: Element is not attached to a Document。下面代码可以看到,绘图的元素this.$refs.imgTransf指向的是div元素,这样是没有问题的, <img class="co...
2019-08-08 22:08:57 21609 5
原创 iview 的Dropdown 下拉菜单click点击无效
iview的文档是个坑啊!!!!!!点击事件后面要加个修饰符native,如@click.native <Dropdown> <span> 在线制作 <Icon type="ios-arrow-down"></Icon> </span> ...
2019-08-03 17:08:40 4261 4
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人