随笔分类 - 前端js vue
摘要:DIV内嵌CSS: <div style="width:98%;margin:auto;"> <div style="width:30%;height:300px;background-color:rgb(145, 176, 145);float:left;">111</div> <div styl
阅读全文
摘要:window.open(url); 改为 window.open(url,"newpage");加了个name属性 基本语法: window.open(pageURL,name,parameters) 其中: pageURL 为子窗口路径 name 为子窗口句柄 parameters 为窗口参数(各
阅读全文
摘要:HTML代码在线运行和预览网站:1:http://jsrun.net/Cj2Kp/edit 2:https://www.w3school.com.cn/tiy/t.asp?f=html5_audio 3:https://jsbin.com/?html,output 还是浏览器自带的js调试工具好用:
阅读全文
摘要:function sleep(milliSeconds) { var startTime = new Date().getTime(); while (new Date().getTime() < startTime + milliSeconds) { //console.log(new Date(
阅读全文
摘要:先执行test1(),再执行test2: function test1() { return new Promise(resolve => { setTimeout(() => resolve("test1"), 2000); }); } function test2() { console.log
阅读全文
摘要:循环显示格言,效果见本博客页面拉到最底部。 <!-- 循环展示 --> <div align="center"> <span id="ewan">永远相信美好的事情即将发生!</span> <script type="text/javascript"> const arr = [ '只要人人都能献出
阅读全文
摘要:// vue.config.js module.exports = {...// 加入下面这行即可,如果加到最后,需要把逗号去掉。 assetsDir:"static", ... } npm run build ls dist favicon.ico index.html static
阅读全文
摘要:传给后端之前先做下替换处理,后端再split就能获取到每行数据,我这里用的是分号进行分隔: this.content.replace(/\n/g,':')
阅读全文
摘要:chinamap.html和china.json两个文件都放到自己的web服务上进行访问,比如nginx. 使用docker镜像搭建简单的静态nginx服务器https://www.cnblogs.com/v5captain/p/14162506.html http://localhost/chin
阅读全文
摘要:let arr1 = [1, 2, 3]; arr1.includes(2) true arr1.indexOf(2)>0 true util.oneOf = function (ele, targetArr) { if (targetArr.indexOf(ele) >= 0) { return
阅读全文
摘要:webpack访问后端开发服务器API,代理URL解决同域名下发送API请求问题(Webpack-dev-server的proxy用法) 首先查看package.json里的--config参数配置的文件,我这里是webpack.dev.config.js "scripts": { "init":
阅读全文
摘要:下面的package.json文件中配置的webpack-dev-server为开发模式,可以使用http://localhost:8080或http://127.0.0.1:8080进行访问 "scripts": { "dev": "cross-env NODE_ENV=development w
阅读全文
摘要:版本不匹配的大坑--一般不要全局安装--在项目目录里用package.json的依赖安装即可 sudo npm uninstall webpack-dev-server -g sudo npm uninstall webpack -g sudo npm install npm run dev
阅读全文
摘要:npm 损坏了,are-we-there-yet是npm所依赖的npmlog依赖的一个包,重新安装npm即可: ➜ lib npm module.js:550 throw err; ^ Error: Cannot find module 'are-we-there-yet' at Function.
阅读全文