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(imagepreview): use nutui image #2793

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions packages/nutui-taro-demo/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Taro from '@tarojs/taro'
import { View, Image, Text, ScrollView, Button, Input, Video } from '@tarojs/components'
import { View, Image, Swiper, SwiperItem, Text, ScrollView, Button, Input, Video } from '@tarojs/components'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

导入了未使用的组件

SwiperSwiperItem 组件虽然在导入语句中声明,但在代码实现中并未找到实际使用。建议移除这些未使用的导入以保持代码整洁。

🔗 Analysis chain

检查未使用的导入

SwiperSwiperItem 组件已导入但在代码中未被使用。如果这些组件是为了图片预览功能准备的,建议添加相关实现;如果不需要,建议移除这些未使用的导入。


Let me gather more information to verify if these components are actually used in the implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:验证Swiper和SwiperItem组件的使用情况

# 在当前文件中搜索Swiper和SwiperItem的使用
rg -l "Swiper|SwiperItem" packages/nutui-taro-demo/src/pages/index/index.tsx

Length of output: 129


Script:

#!/bin/bash
# Search for actual usage of Swiper and SwiperItem components in the file content
rg -U "(?s)<Swiper.*?>.*?</Swiper>|<SwiperItem.*?>.*?</SwiperItem>" packages/nutui-taro-demo/src/pages/index/index.tsx

# Also check for self-closing tag usage
rg "<Swiper[^>]*/?>|<SwiperItem[^>]*/?>" packages/nutui-taro-demo/src/pages/index/index.tsx

Length of output: 214

import pkg from '@/packages/../config.json'
import packageJson from '@/packages/../../package.json'
import './index.scss'
Expand All @@ -10,7 +10,7 @@ const navs = pkg.nav


// hack taro load button xml
console.log(Button, Input, Video )
console.log(Button, Input, Video,Image, Swiper, SwiperItem, )

// try {
// console.log('xxx', Schema)
Expand Down
7 changes: 7 additions & 0 deletions src/packages/imagepreview/imagepreview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
justify-content: center;
height: 100%;

.nut-image,
.nut-video {
display: flex;
justify-content: center;
align-items: center;
}

.nut-image-preview-box {
width: 100%;
}
Expand Down
10 changes: 2 additions & 8 deletions src/packages/imagepreview/imagepreview.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@ import React, {
ReactNode,
} from 'react'
import Taro from '@tarojs/taro'
import {
ITouchEvent,
Video as TaroVideo,
Image,
View,
} from '@tarojs/components'
import { ITouchEvent, Video as TaroVideo, View } from '@tarojs/components'
import classNames from 'classnames'
import { Close } from '@nutui/icons-react-taro'
import Popup from '@/packages/popup/index.taro'
import Image from '@/packages/image/index.taro'
import Swiper from '@/packages/swiper/index.taro'
import SwiperItem from '@/packages/swiperitem/index.taro'

Expand Down Expand Up @@ -342,7 +338,6 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
key={index}
className="nut-imagepreview-swiper-item"
>
(
<Image
src={src}
mode="widthFix"
Expand All @@ -352,7 +347,6 @@ export const ImagePreview: FunctionComponent<Partial<ImagePreviewProps>> = (
showMenuByLongpress,
})}
/>
)
</SwiperItem>
)
}
Expand Down
Loading