We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好,我发现网页程序里是支持传入 title 查询参数自定义保存文件名的,但是 getSource() 方法中 this.url = href.split('?source=')[1] 会导致将其他查询参数一起解析出来。
title
getSource()
this.url = href.split('?source=')[1]
建议使用 new URL(location.href).searchParams.get('source') 解析资源链接,为了避免影响其他方法继续使用 this.url 解析变量,可以将 source 单独提取成员变量出来。
new URL(location.href).searchParams.get('source')
this.url
source
The text was updated successfully, but these errors were encountered:
或者说,解析 title 变量时,不应再从 this.url 取值,而是从原始的 URL 取值。
- this.title = new URL(this.url).searchParams.get('title') || this.title // 获取视频标题 + this.title = new URL(location.href).searchParams.get('title') || this.title // 获取视频标题
即使如此, href.split('?source=')[1] 也不太优雅,如果是外部调用,source 不在查询参数的第一项的位置时,就解析失效了。
href.split('?source=')[1]
Sorry, something went wrong.
No branches or pull requests
你好,我发现网页程序里是支持传入
title
查询参数自定义保存文件名的,但是getSource()
方法中this.url = href.split('?source=')[1]
会导致将其他查询参数一起解析出来。建议使用
new URL(location.href).searchParams.get('source')
解析资源链接,为了避免影响其他方法继续使用this.url
解析变量,可以将source
单独提取成员变量出来。The text was updated successfully, but these errors were encountered: