// 初始化
var vConsole = new VConsole();
const hasAttr = (e,a) => a.some(_=> e.attr(_)!==undefined);
$('a').each(function() {
const $this = $(this);
if(hasAttr($this,["data-fancybox","ignore-external-link"])) return;
const href = $this.attr('href');
if (href && href.match('^((http|https|thunder|qqdl|ed2k|Flashget|qbrowser|ftp|rtsp|mms)://)')) {
const strs = href.split('/');
if (strs.length >= 3) {
const host = strs[2];
if (host !== 'your_domain' || window.location.host) {
$this.attr('href', '/go.html?u='+Base64.encode(href)+'').attr('rel', 'external nofollow noopener noreferrer');
if (true) {
$this.attr('target', '_blank');
}
}
}
}
});
const hasAttr = (e,a) => a.some(_=> e.attr(_)!==undefined);
$('a').each(function() {
const $this = $(this);
if(hasAttr($this,["data-fancybox","ignore-external-link"])) return;
const href = $this.attr('href');
if (href && href.match('^((http|https|thunder|qqdl|ed2k|Flashget|qbrowser|ftp|rtsp|mms)://)')) {
const strs = href.split('/');
if (strs.length >= 3) {
const host = strs[2];
if (host !== 'your_domain' || window.location.host) {
$this.attr('href', '/go.html?u='+Base64.encode(href)+'').attr('rel', 'external nofollow noopener noreferrer');
if (true) {
$this.attr('target', '_blank');
}
}
}
}
});
const hasAttr = (e,a) => a.some(_=> e.attr(_)!==undefined);
$('a').each(function() {
const $this = $(this);
if(hasAttr($this,["data-fancybox","ignore-external-link"])) return;
const href = $this.attr('href');
if (href && href.match('^((http|https|thunder|qqdl|ed2k|Flashget|qbrowser|ftp|rtsp|mms)://)')) {
const strs = href.split('/');
if (strs.length >= 3) {
const host = strs[2];
if (host !== 'your_domain' || window.location.host) {
$this.attr('href', '/go.html?u='+Base64.encode(href)+'').attr('rel', 'external nofollow noopener noreferrer');
if (true) {
$this.attr('target', '_blank');
}
}
}
}
});
1.安装 npm
npm i vconsole
2.main.js 引入,并判断非生产环境使⽤
//import Vconsole from 'vconsole'
//let vConsole = new Vconsole()
//Vue.use(vConsole)
import VConsole from 'vconsole'
if (process.env.NODE_ENV === 'development') {
var vConsole = new VConsole()
app.use(vConsole)
}