mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-29 01:39:15 +08:00
types(CouponCell): use tsx (#8089)
This commit is contained in:
parent
1b75c706ab
commit
efa8c0e798
@ -1,10 +1,17 @@
|
|||||||
|
import { PropType } from 'vue';
|
||||||
import { isDef, createNamespace } from '../utils';
|
import { isDef, createNamespace } from '../utils';
|
||||||
|
import type { CouponInfo } from '../coupon';
|
||||||
|
|
||||||
|
// Components
|
||||||
import Cell from '../cell';
|
import Cell from '../cell';
|
||||||
|
|
||||||
const [createComponent, bem, t] = createNamespace('coupon-cell');
|
const [createComponent, bem, t] = createNamespace('coupon-cell');
|
||||||
|
|
||||||
function formatValue(props) {
|
function formatValue(
|
||||||
const { coupons, chosenCoupon, currency } = props;
|
coupons: CouponInfo[],
|
||||||
|
chosenCoupon: number | string,
|
||||||
|
currency: string
|
||||||
|
) {
|
||||||
const coupon = coupons[+chosenCoupon];
|
const coupon = coupons[+chosenCoupon];
|
||||||
|
|
||||||
if (coupon) {
|
if (coupon) {
|
||||||
@ -26,7 +33,7 @@ export default createComponent({
|
|||||||
props: {
|
props: {
|
||||||
title: String,
|
title: String,
|
||||||
coupons: {
|
coupons: {
|
||||||
type: Array,
|
type: Array as PropType<CouponInfo[]>,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
},
|
||||||
currency: {
|
currency: {
|
||||||
@ -50,7 +57,11 @@ export default createComponent({
|
|||||||
setup(props) {
|
setup(props) {
|
||||||
return () => {
|
return () => {
|
||||||
const selected = props.coupons[+props.chosenCoupon];
|
const selected = props.coupons[+props.chosenCoupon];
|
||||||
const value = formatValue(props);
|
const value = formatValue(
|
||||||
|
props.coupons,
|
||||||
|
props.chosenCoupon,
|
||||||
|
props.currency
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Cell
|
<Cell
|
Loading…
x
Reference in New Issue
Block a user