公司演示版e鹿悦游
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
CjyTravel/plugin/mixin/GlobalMixin.js

50 lines
1.1 KiB

import {ImgHost} from "../util/Host";
import $ from "../util/Ajax";
import {DefaultImg} from '../util/Domain'
const DefaultImgArr = [];
for (let defaultImgKey in DefaultImg) {
if (DefaultImg.hasOwnProperty(defaultImgKey)) {
DefaultImgArr.push(DefaultImg[defaultImgKey])
}
}
/**
* 混入对象,在 main.js 里调用 相当于全局方法。。
*/
export default {
data: () => ({
// 是否正在执行 ajax 请求
isAjax: false
}),
methods: {
/**
* 获取 图片访问路径
* @param img
* @return {string}
*/
GetImgUrl(img) {
if (DefaultImgArr.indexOf(img) !== -1) {
return img;
}
let url = img;
if (img.endsWith(",")) {
url = img.substring(0, img.length - 1);
}
const t = this;
let path = ImgHost + url;
// path = '/static/wl-testImg/wl-swiper01.jpg'
return path;
},
// 此方法可能需要重写......
ImgError(e, item) {
item.logo = '';
}
}
}