Skip to content

Commit

Permalink
fix: 在某些上下文中location取值非全局的 (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
YufJi committed Nov 10, 2023
1 parent 1c75af4 commit 1030fbf
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function Button(
let to;
if (props.destination) {
if (props.destination.startsWith('http')) {
location.href = encodeUrl(props.destination);
window.location.href = encodeUrl(props.destination);
return;
}
to = props.destination;
Expand Down
2 changes: 1 addition & 1 deletion src/cardu/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default {
let to;
if (props.destination) {
if (props.destination.startsWith('http')) {
location.href = encodeUrl(props.destination);
window.location.href = encodeUrl(props.destination);
return;
}
to = props.destination;
Expand Down
2 changes: 1 addition & 1 deletion src/cell/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default createComponent({
let to;
if (props.destination) {
if (props.destination.startsWith('http')) {
location.href = encodeUrl(props.destination);
window.location.href = encodeUrl(props.destination);
return;
}
to = props.destination;
Expand Down
6 changes: 3 additions & 3 deletions src/cellson/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ export default createComponent({
{((!isDef(rtitle) || rtitle === '') && !slots()) ? <van-empty-col></van-empty-col> : null}
</div>
);
}
}
if (showValue) {
return (
<div class={[bem('value', { alone: singleslot }), props.valueClass]}>
{slots() ? slots() : <span>{rtitle}</span>}
</div>
);
}

}

function LeftIcon() {
Expand Down Expand Up @@ -241,7 +241,7 @@ export default createComponent({
let to;
if (props.destination) {
if (props.destination.startsWith('http')) {
location.href = encodeUrl(props.destination);
window.location.href = encodeUrl(props.destination);
return;
}
to = props.destination;
Expand Down
2 changes: 1 addition & 1 deletion src/notice-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default createComponent({
let to;
if (props.destination) {
if (props.destination.startsWith('http')) {
location.href = encodeUrl(props.destination);
window.location.href = encodeUrl(props.destination);
return;
}
to = props.destination;
Expand Down
2 changes: 1 addition & 1 deletion src/sidebar-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export default createComponent({
let to;
if (props.destination) {
if (props.destination.startsWith('http')) {
location.href = encodeUrl(props.destination);
window.location.href = encodeUrl(props.destination);
return;
}
to = props.destination;
Expand Down

0 comments on commit 1030fbf

Please sign in to comment.