一、单词排序
let arr = ['abc', 'aba', 'aef', 'Def', 'BoC', 'FED'];
let arrSort = arr.sort(function(s, t) {
let a = s.toLowerCase();
let b = t.toLowerCase();
if (a < b) return -1;
if (a > b) return 1;
return 0;
})
alert(arrSort);
运行结果:
[ 'aba', 'abc', 'aef', 'BoC', 'Def', 'FED' ]
二、提取链接中的参数
let url111 ='https://html?channel=tt&bid=3510520&sid=11047&reffer=3002170&teacher=xxx&clickid=xxx'
function getUrlObj (url){
let str=url.split('?')[1].split("&")
let urlObj={};
str.forEach(v=>{
urlObj[v.split("=")[0]]=v.split("=")[1]
})
return urlObj
}
console.log(getUrlObj(url111));
输出//{
channel: 'tt',
bid: '3510520',
sid: '11047',
reffer: '3002170',
teacher: 'xxx',
clickid: 'xxx'
}
三、vue-cli 3 4打包VUE项目出现空白页面解决方案 1.你的vue-cli必须是3或者4的 不然不要继续看 2.在项目文件下创建vue.config.js,然后重新打包就完事了
module.exports = {
publicPath: "./",
assetsDir: "static",
outputDir: 'dist',
}
|