Skip to content

Commit

Permalink
fix(Link): resolve disabled problem
Browse files Browse the repository at this point in the history
  • Loading branch information
anlyyao committed Apr 25, 2023
1 parent 1737ab5 commit 5f7fb27
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions src/link/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ exports[`Link Link disabled demo works fine 1`] = `
content="跳转链接"
disabled="{{true}}"
hover="{{true}}"
navigatorProps="{{
Object {
"url": "/pages/home/home",
}
}}"
size="small"
suffixIcon="jump"
theme="primary"
Expand Down
5 changes: 5 additions & 0 deletions src/link/__test__/__virtualHostSnapshot__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ exports[`Link Link disabled demo works fine 1`] = `
content="跳转链接"
disabled="{{true}}"
hover="{{true}}"
navigatorProps="{{
Object {
"url": "/pages/home/home",
}
}}"
size="small"
suffixIcon="jump"
theme="primary"
Expand Down
8 changes: 7 additions & 1 deletion src/link/_example/disabled/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
Component({});
Component({
data: {
navigatorProps: {
url: '/pages/home/home',
},
},
});
10 changes: 9 additions & 1 deletion src/link/_example/disabled/index.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<view class="link-example">
<t-link size="small" theme="primary" content="跳转链接" suffixIcon="jump" disabled hover />
<t-link
navigatorProps="{{navigatorProps}}"
size="small"
theme="primary"
content="跳转链接"
suffixIcon="jump"
disabled
hover
/>
<t-link size="small" content="跳转链接" suffixIcon="jump" disabled />
<t-link size="small" theme="danger" content="跳转链接" suffixIcon="jump" disabled />
</view>
Expand Down
2 changes: 1 addition & 1 deletion src/link/link.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
class="{{className}} class {{prefix}}-class"
style="{{_._style([style, customStyle])}}"
target="{{navigatorProps.target}}"
url="{{navigatorProps.url}}"
url="{{ !disabled && navigatorProps.url}}"
open-type="{{navigatorProps.openType || 'navigate'}}"
delta="{{navigatorProps.delta}}"
app-id="{{navigatorProps.appId}}"
Expand Down

0 comments on commit 5f7fb27

Please sign in to comment.