网站首页 > 知识剖析 正文
//要结合项目实际需求打印结果看看,按需使用
onLoad() {
// 获取当前页面地址,如http://localhost:8080/admin/index
let wPath = window.document.location.href;
console.log('页面路径'+wPath);
// 获取当前页面主机地址之后的目录,如:/admin/index
let pathName = this.$route.path;
console.log('获取当前页面主机地址之后的目录'+pathName);
let pos = wPath.indexOf(pathName);
console.log("pos~~"+pos)
// 获取主机地址,如:http://localhost:8080
let localhostPath = wPath.substring(0, pos);
console.log("主机地址~~"+localhostPath);
},
猜你喜欢
- 2024-12-11 回复小伙伴 Win徽标没反应的解决方案来了
- 2024-12-11 Windows 8.1中定时启动关闭软件
- 2024-12-11 Unity(WebGL)与JS通讯2021最新姿势
- 2024-12-11 更新后文件系统闹错误?看编号2招搞定
- 2024-12-11 15种常用的在线工具网站清单「值得收藏」
- 2024-12-11 浏览器打不开、SSD数据泄露……Windows系统这些坑你遇到了吗
- 2024-12-11 快速接入 GitHub、QQ 第三方登录方式
- 2024-12-11 深度解决win10应用商店不见了的解决方法
- 2024-12-11 系统小技巧:尝鲜Windows 10 烦心事巧解决
- 2024-12-11 IT之家学院:一个命令重装Win10内置应用
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)