mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-28 04:16:35 +08:00
[new feature] Sku: support custom placeholder (#3864)
This commit is contained in:
parent
511087bc74
commit
aba5f59fdd
@ -211,7 +211,8 @@ sku: {
|
|||||||
multiple: '0',
|
multiple: '0',
|
||||||
name: 'Message',
|
name: 'Message',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
required: '1'
|
required: '1',
|
||||||
|
placeholder: ''
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
hide_stock: false
|
hide_stock: false
|
||||||
@ -278,7 +279,7 @@ messageConfig: {
|
|||||||
},
|
},
|
||||||
// max file size (MB)
|
// max file size (MB)
|
||||||
uploadMaxSize: 3,
|
uploadMaxSize: 3,
|
||||||
// placehold config
|
// placeholder config
|
||||||
placeholderMap: {
|
placeholderMap: {
|
||||||
text: 'xxx',
|
text: 'xxx',
|
||||||
tel: 'xxx',
|
tel: 'xxx',
|
||||||
|
@ -221,7 +221,8 @@ sku: {
|
|||||||
multiple: '0', // 留言类型为 text 时,是否多行文本。'1' 表示多行
|
multiple: '0', // 留言类型为 text 时,是否多行文本。'1' 表示多行
|
||||||
name: '留言', // 留言名称
|
name: '留言', // 留言名称
|
||||||
type: 'text', // 留言类型,可选: id_no(身份证), text, tel, date, time, email
|
type: 'text', // 留言类型,可选: id_no(身份证), text, tel, date, time, email
|
||||||
required: '1' // 是否必填 '1' 表示必填
|
required: '1', // 是否必填 '1' 表示必填
|
||||||
|
placeholder: '' // 可选值,占位文本
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
hide_stock: false // 是否隐藏剩余库存
|
hide_stock: false // 是否隐藏剩余库存
|
||||||
@ -290,7 +291,7 @@ messageConfig: {
|
|||||||
},
|
},
|
||||||
// 最大上传体积 (MB)
|
// 最大上传体积 (MB)
|
||||||
uploadMaxSize: 3,
|
uploadMaxSize: 3,
|
||||||
// placehold配置
|
// placeholder 配置
|
||||||
placeholderMap: {
|
placeholderMap: {
|
||||||
text: 'xxx',
|
text: 'xxx',
|
||||||
tel: 'xxx',
|
tel: 'xxx',
|
||||||
|
@ -85,7 +85,7 @@ export default createComponent({
|
|||||||
getPlaceholder(message) {
|
getPlaceholder(message) {
|
||||||
const type = +message.multiple === 1 ? 'textarea' : message.type;
|
const type = +message.multiple === 1 ? 'textarea' : message.type;
|
||||||
const map = this.messageConfig.placeholderMap || {};
|
const map = this.messageConfig.placeholderMap || {};
|
||||||
return map[type] || PLACEHOLDER[type];
|
return message.placeholder || map[type] || PLACEHOLDER[type];
|
||||||
},
|
},
|
||||||
|
|
||||||
validateMessages() {
|
validateMessages() {
|
||||||
|
@ -39,6 +39,7 @@ export type SkuMessageData = {
|
|||||||
required?: string;
|
required?: string;
|
||||||
datetime?: string;
|
datetime?: string;
|
||||||
multiple?: string;
|
multiple?: string;
|
||||||
|
placeholder?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SkuGoodsData = {
|
export type SkuGoodsData = {
|
||||||
|
@ -3,9 +3,7 @@ import { InjectOptions, PropsDefinition } from 'vue/types/options';
|
|||||||
|
|
||||||
export type EventHandler = (event: Event) => void;
|
export type EventHandler = (event: Event) => void;
|
||||||
|
|
||||||
export type ObjectIndex = {
|
export type ObjectIndex = Record<string, any>;
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ScopedSlot<Props = any> = (props?: Props) => VNode[] | VNode | undefined;
|
export type ScopedSlot<Props = any> = (props?: Props) => VNode[] | VNode | undefined;
|
||||||
|
|
||||||
@ -22,7 +20,7 @@ export type ModelOptions = {
|
|||||||
event?: string;
|
event?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type DefaultProps = Record<string, any>;
|
export type DefaultProps = ObjectIndex;
|
||||||
|
|
||||||
export type FunctionComponent<Props = DefaultProps, PropDefs = PropsDefinition<Props>> = {
|
export type FunctionComponent<Props = DefaultProps, PropDefs = PropsDefinition<Props>> = {
|
||||||
(h: CreateElement, props: Props, slots: ScopedSlots, context: RenderContext<Props>):
|
(h: CreateElement, props: Props, slots: ScopedSlots, context: RenderContext<Props>):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user