mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Sku): sku supports message initialization (#5668)
This commit is contained in:
parent
ee9396c4c3
commit
baf9ffb611
@ -350,6 +350,11 @@ messageConfig: {
|
||||
text: 'xxx',
|
||||
tel: 'xxx',
|
||||
...
|
||||
},
|
||||
// Key:message name
|
||||
// Value:message value
|
||||
initialMessages: {
|
||||
message: 'message value'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -346,6 +346,12 @@ messageConfig: {
|
||||
text: 'xxx',
|
||||
tel: 'xxx',
|
||||
...
|
||||
},
|
||||
// 初始留言信息
|
||||
// 键:留言 name
|
||||
// 值:留言内容
|
||||
initialMessages: {
|
||||
留言: '留言信息'
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -81,6 +81,7 @@ export default createComponent({
|
||||
messageConfig: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
initialMessages: {},
|
||||
placeholderMap: {},
|
||||
uploadImg: () => Promise.resolve(),
|
||||
uploadMaxSize: 5,
|
||||
|
@ -35,7 +35,10 @@ export default createComponent({
|
||||
|
||||
methods: {
|
||||
resetMessageValues(messages) {
|
||||
return (messages || []).map(() => ({ value: '' }));
|
||||
const { messageConfig } = this;
|
||||
return (messages || []).map(message => ({
|
||||
value: messageConfig.initialMessages[message.name] || '',
|
||||
}));
|
||||
},
|
||||
|
||||
getType(message) {
|
||||
|
@ -198,6 +198,9 @@ export default {
|
||||
},
|
||||
},
|
||||
messageConfig: {
|
||||
initialMessages: {
|
||||
留言1: '商品留言',
|
||||
},
|
||||
uploadImg: (file, img) =>
|
||||
new Promise(resolve => {
|
||||
setTimeout(() => resolve(img), 1000);
|
||||
|
Loading…
x
Reference in New Issue
Block a user