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