2、Uncaught TypeError: Object(…) is not a function at resetStoreState
在Vue2中使用Vuex4.0以上版本会报这个错误
引起这个错误的原因是因为Vuex4.0以上版本依赖于Vue3中的一些属性方法
解决方案
npm uninstall vuex
npm install vuex@3.4.0
// 将版本转换为3.4.0即可完美解决这个问题
3、window.location获取url各项参数详解
1.href ----- 整个URL字符串.
2.protocol ----- 含有URL第一部分的字符串,如https.
3.host ----- 主机名.
4.port ----- 端口号.
5.pathname ----- 路径.
6.search ----- “?” 之后的字符串.
7.hash ----- “#” 之后的字符串.
下面举个例子,有这样一个URL
https://www.djhero.com:80/dj/post/0805/dongjing.html?ver=1.0&id=1#happy
1.window.location.href
整个URl字符串(浏览器完整的地址栏)
返回值:
https://www.djhero.com:80/dj/post/0805/dongjing.html?ver=1.0&id=6#happy
2.window.location.protocol
URL的协议部分
返回值:
https:
1
3.window.location.host & window.location.hostname
URL的主机部分
返回值:
www.djhero.com
1
4.window.location.port
URL的端口部分
返回值:" "
Note: If the port number is default (80 for http and 443 for https), most browsers will display 0 or nothing.
5.window.location.pathname
URL的路径部分
返回值:
/dj/post/0805/dongjing.html
6.window.location.search
查询部分
返回值:
?ver=1.0&id=1
7.window.location.hash
锚点
返回值:
#happy
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文系转载,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。