Skip to content
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
2 changes: 1 addition & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@
"author": "swag~jun"
},
{
"version": "2.0.0",
"version": "3.0.0",
"name": "Card",
"type": "component",
"cName": "商品卡片",
Expand Down
21 changes: 3 additions & 18 deletions src/packages/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,28 +39,13 @@
line-height: 18px;
margin-top: 9px;

.nut-price {
.nut-price-big {
font-size: 18px;
}

.nut-price-symbol,
.nut-price-point,
.nut-price-small {
font-size: 12px;
}
}

&-origin {
&.nut-price {
margin-left: 2px;
color: #d2a448;

.nut-price-big,
.nut-price-symbol,
.nut-price-point,
.nut-price-small {
font-size: 12px;
.nut-price-integer,
.nut-price-decimal {
color: #d2a448;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/packages/card/card.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { View } from '@tarojs/components'
import classNames from 'classnames'
import Price from '@/packages/price/index.taro'
import Tag from '@/packages/tag/index.taro'
import Image from '@/packages/image/index.taro'
import { BasicComponent, ComponentDefaults } from '@/utils/typings'

export interface CardProps extends BasicComponent {
Expand Down Expand Up @@ -58,7 +59,7 @@ export const Card: FunctionComponent<
return (
<div className={classNames(classPrefix, className)} style={style} {...rest}>
<View className={`${classPrefix}-left`}>
<img src={src} alt="" />
<Image src={src} />
</View>
<View className={`${classPrefix}-right`}>
<View className={`${classPrefix}-right-title`}>{title}</View>
Expand Down
20 changes: 8 additions & 12 deletions src/packages/card/demos/h5/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { Card } from '@nutui/nutui-react'
import { Card, Tag } from '@nutui/nutui-react'

const Demo2 = () => {
const state = {
Expand All @@ -13,13 +13,6 @@ const Demo2 = () => {
shopName: '阳澄湖大闸蟹自营店>',
}
const wordStyles = {
padding: '0 5px',
borderRadius: '1px',
fontSize: '10px',
height: '15px',
lineHeight: '15px',
color: '#999',
backgroundColor: '#f2f2f7',
marginRight: '5px',
}
return (
Expand All @@ -33,18 +26,21 @@ const Demo2 = () => {
shopName={state.shopName}
description={
<div
className="search_prolist_attr"
style={{
display: 'inline-flex',
margin: '3px 0 1px',
height: '15px',
}}
>
{['鲜活', '礼盒', '国产'].map((item) => {
return (
<span style={wordStyles} className="word" key={item}>
<Tag
background="#f2f2f7"
color="#999999"
key={item}
style={wordStyles}
>
{item}
</span>
</Tag>
)
})}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/card/demos/taro/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Card } from '@nutui/nutui-react-taro'

const Demo1 = () => {
const state = {
src: '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
src: 'https://img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
title:
'【活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
price: '388',
Expand Down
29 changes: 13 additions & 16 deletions src/packages/card/demos/taro/demo2.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react'
import { Card, Tag } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'
import { Card } from '@nutui/nutui-react-taro'
import pxTransform from '@/utils/px-transform'

const Demo2 = () => {
const state = {
src: '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
src: 'https://img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
title:
'【活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
price: '388',
Expand All @@ -14,14 +15,7 @@ const Demo2 = () => {
shopName: '阳澄湖大闸蟹自营店>',
}
const wordStyles = {
padding: '0 5px',
borderRadius: '1px',
fontSize: '10px',
height: '15px',
lineHeight: '15px',
color: '#999',
backgroundColor: '#f2f2f7',
marginRight: '5px',
marginRight: pxTransform(5),
}
return (
<Card
Expand All @@ -34,18 +28,21 @@ const Demo2 = () => {
shopName={state.shopName}
description={
<View
className="search_prolist_attr"
style={{
display: 'inline-flex',
margin: '3px 0 1px',
height: '15px',
display: 'flex',
margin: `${pxTransform(3)} 0 ${pxTransform(1)}`,
}}
>
{['鲜活', '礼盒', '国产'].map((item) => {
return (
<span style={wordStyles} className="word" key={item}>
<Tag
background="#f2f2f7"
color="#999999"
key={item}
style={wordStyles}
>
{item}
</span>
</Tag>
)
})}
</View>
Expand Down
18 changes: 9 additions & 9 deletions src/packages/card/demos/taro/demo3.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react'
import { Card } from '@nutui/nutui-react-taro'
import { Card, Image } from '@nutui/nutui-react-taro'
import pxTransform from '@/utils/px-transform'

const Demo3 = () => {
const state = {
src: '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
src: 'https://img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
title:
'【活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
price: '388',
Expand All @@ -13,11 +14,9 @@ const Demo3 = () => {
shopName: '阳澄湖大闸蟹自营店>',
}
const tagStyles = {
display: 'inline-block',
verticalAlign: 'middle',
marginRight: '5px',
marginLeft: '2px',
height: '14px',
display: 'inline-flex',
marginRight: pxTransform(5),
marginLeft: pxTransform(2),
}
return (
<Card
Expand All @@ -29,10 +28,11 @@ const Demo3 = () => {
delivery={state.delivery}
shopName={state.shopName}
priceTag={
<img
<Image
style={tagStyles}
height={pxTransform(14)}
width={pxTransform(29)}
src="https://img11.360buyimg.com/jdphoto/s58x28_jfs/t9451/359/415622649/15318/b0943e5d/59a78495N3bd2a9f8.png"
alt=""
/>
}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/packages/card/demos/taro/demo4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Card } from '@nutui/nutui-react-taro'

const Demo4 = () => {
const state = {
src: '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
src: 'https://img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
title:
'【活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
price: '388',
Expand Down
5 changes: 3 additions & 2 deletions src/packages/card/demos/taro/demo5.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react'
import { View } from '@tarojs/components'
import { Card } from '@nutui/nutui-react-taro'
import pxTransform from '@/utils/px-transform'

const Demo5 = () => {
const state = {
src: '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
src: 'https://img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
title:
'【活蟹】湖塘煙雨 阳澄湖大闸蟹公4.5两 母3.5两 4对8只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
price: '388',
Expand All @@ -23,7 +24,7 @@ const Demo5 = () => {
shopDescription={state.shopDescription}
delivery={state.delivery}
shopName={state.shopName}
extra={<View style={{ fontSize: '12px' }}>自定义</View>}
extra={<View style={{ fontSize: pxTransform(12) }}>自定义</View>}
Copy link
Collaborator

@oasis-cloud oasis-cloud Nov 28, 2024

Choose a reason for hiding this comment

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

我看现在直接写数字表现就挺好的,可以试一下

/>
)
}
Expand Down
14 changes: 11 additions & 3 deletions src/packages/card/demos/taro/demo6.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import React from 'react'
import { Card } from '@nutui/nutui-react-taro'
import { View } from '@tarojs/components'
import pxTransform from '@/utils/px-transform'

const Demo6 = () => {
const state = {
src: '//img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
src: 'https://img10.360buyimg.com/n2/s240x240_jfs/t1/210890/22/4728/163829/6163a590Eb7c6f4b5/6390526d49791cb9.jpg!q70.jpg',
title:
'【活蟹】湖塘煙雨 阳澄湖大闸蟹公 4.5 两 母 3.5 两 4 对 8 只 鲜活生鲜螃蟹现货水产礼盒海鲜水',
}
Expand All @@ -13,9 +15,15 @@ const Demo6 = () => {
src={state.src}
title={state.title}
description={
<div style={{ fontSize: '14px', padding: '10px 0', color: '#999' }}>
<View
style={{
fontSize: pxTransform(14),
padding: `${pxTransform(10)} 0`,
color: '#999',
}}
>
阳澄湖大闸蟹鲜活生鲜螃蟹现货水产礼盒海鲜水
</div>
</View>
}
/>
)
Expand Down
Loading