methods: {
// 添加了图片之后触发的事件
fileChange (res){
// console.log(res)
// console.log(res.target.files[0].name)
// 拿到 files(数组),然后提交到后端,完成之后,把新的图片加到 imgList中去
// 加载层
var loading = this.$weui.loading('loading')
// 例如现在拿到了
const that = this
setTimeout(function(){
// loading.hide()
// that.imgList.push({id:4, imgUrl: 'https://csdnimg.cn/cdn/content-toolbar/csdn-logo_.png?v=20190924.1'})
var src, url = window.URL || window.webkitURL || window.mozURL
var files = res.target.files
for (var i = 0, len = files.length; i < len; ++i) {
let file = files[i];
if (url) {
src = url.createObjectURL(file);
} else {
//不支持 url, 则显示错误
// src = e.target.result;
}
// src 为 src=blob:http://localhost:8080/ed1399f6-3850-475d-b9b2-4d9624be9f97 为本地的路径
that.imgList.push({id: 4, imgUrl: src})
// $uploaderFiles.append($(tmpl.replace('#url#', src)));
}
loading.hide()
}, 2000)
}
},
添加blog本地图片
猜你喜欢
转载自blog.csdn.net/codipy/article/details/103234955
今日推荐
周排行