window.alert = function (obj) {
	var iframe = document.createElement('iframe');
	iframe.src = 'javascript:void(0);'
	document.body.appendChild(iframe)
	iframe.contentWindow.alert(obj);
	iframe.parentNode.removeChild(iframe);
}

window.hugo={}
window.hugo.iframes=[]
let iframes=window.hugo.iframes;
var openIframe=function(html,body){
	// 1. 创建<iframe>元素
	var ifr = document.createElement('iframe');
//	// 2. 将CSS,HTML字符串转换为Blob对象
//	var blob = new Blob([html], {
//	  'type': 'text/html'
//	});
//	// 3. 使用URL.createObjectURL()方法将...
//	iframe.src = URL.createObjectURL(blob);
	body.innerHTML = "";
	body.appendChild(ifr);
	var ifrw = (ifr.contentWindow) ? ifr.contentWindow: (ifr.contentDocument.document) ? ifr.contentDocument.document: ifr.contentDocument;
	ifrw.document.open();
	ifrw.document.write(html);
	ifrw.document.close();
	//console.log(x)
}
//开启页面html
{

    let xx = $("#cnblogs_post_body,.cnblogs-post-body").find("[data-type=html]");
    let xxx = [];
    for (let x of xx) {
        xxx.push(x.innerText)
    };
    xx.remove();
    let URL = window.URL || window.webkitURL;
    for (let x of xxx) {
		//openIframe(x,document.body)
		iframes.push(x);
    };
}

1.基本环境搭建

安装Node.js和npm

首先,从Node.js官网下载对应平台的安装程序,在Windows上安装时务必选择全部组件,包括勾选Add to Path,npm已经在Node.js安装的时候顺带装好了.

C:\Users\Hugo>node -v

v10.14.1

C:\Users\Hugo>npm -v

6.4.1

 

安装Yarn

C:\Users\Hugo>npm install -g yarn

C:\Users\Hugo>yarn -v

1.12.3

国内源镜像加速

C:\Users\Hugo>yarn config set registry https://registry.npm.taobao.org
yarn config v1.12.3
success Set "registry" to "https://registry.npm.taobao.org".
Done in 0.03s.

添加vuex模块和chromedriver模块,因为在构建项目过程中chromedriver可能会下载失败

C:\Users\Hugo>yarn add vuex

C:\Users\Hugo>yarn add chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver

安装vue-cli

C:\Users\Hugo>yarn global add @vue/cli

vue命令还无法使用,需要进行path配置

C:\Users\Hugo>yarn global dir

C:\Users\Hugo\AppData\Local\Yarn\Data\global

C:\Users\Hugo\AppData\Local\Yarn\bin加入path

就可以使用vue命令了

C:\Users\Hugo>vue -V
3.2.1

posted @ 2018-12-09 19:42  离线云  阅读(196)  评论(0编辑  收藏  举报