Skip to content
New issue

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

feat: 新增监听initialIndex值的变化,动态去改变currentSwiperIndex #3103

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/image-viewer/image-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export default class ImageViewer extends SuperComponent {
key: 'visible',
event: 'close',
},
{
key:'initialIndex'
}
];

ready() {
Expand All @@ -42,6 +45,11 @@ export default class ImageViewer extends SuperComponent {
}

observers = {
initialIndex(value) {
this.setData({
currentSwiperIndex: value,
})
},
visible(value) {
this.setData({
currentSwiperIndex: value ? this.properties.initialIndex : 0,
Expand All @@ -59,6 +67,8 @@ export default class ImageViewer extends SuperComponent {
_deleteBtn: calcIcon(v, 'delete'),
});
},


};

methods = {
Expand Down
Loading