javascript - Vue.js。如何在 index.html 文件中获取当前 url?
问题描述
Vue.js。如何在 index.html 文件中获取当前 url?使用 index.html 中的纯 js,我只得到起始页的 url。要获取其他页面的 url,我必须刷新或保留初始页面的值。
<!-- index.php laravel blade -->
<div id="ui">
<router-view></router-view>
</div>
<script>
window.CanvasUI = @json($config);
</script>
<script type="text/javascript" src="{{ asset(mix('js/canvas-ui.js')) }}"></script>
解决方案
使用纯 JS:
window.location.href
推荐阅读
- typescript - 获取无效的 Chai 属性:'callWith'
- php - 表名和列名的命名策略(Doctrine ORM)
- firebird - 将双精度列转换为日期时的舍入伪影
- c - 为什么 memset 在 calloc 之后调用?
- batch-file - 在每行中批量插入行号
- json - 如何在不重复代码的情况下填充 JSON 对象的一部分?
- c# - Xamarin.UITest 在视图中检索所有元素
- android - 在 React Native 中加载屏幕时如何滚动到顶部?
- python - 在测试执行期间重定向文件中的所有类型的异常和标准输出日志 - Python 3
- notepad++ - notepad++ 用户定义语言折叠打开和关闭