2023-05-01 19:01:24 +08:00
|
|
|
|
import SkuList from './SkuList.vue'
|
2023-04-24 11:42:44 +08:00
|
|
|
|
|
2023-07-05 18:24:32 +08:00
|
|
|
|
interface PropertyAndValues {
|
2023-06-24 01:48:07 +08:00
|
|
|
|
id: number
|
|
|
|
|
name: string
|
2023-07-05 18:24:32 +08:00
|
|
|
|
values?: PropertyAndValues[]
|
2023-06-24 01:48:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface RuleConfig {
|
2023-06-25 16:43:49 +08:00
|
|
|
|
// 需要校验的字段
|
|
|
|
|
// 例:name: 'name' 则表示校验 sku.name 的值
|
|
|
|
|
// 例:name: 'productConfig.stock' 则表示校验 sku.productConfig.name 的值,此处 productConfig 表示我在 Sku 上扩展的属性
|
|
|
|
|
name: string
|
|
|
|
|
// 校验规格为一个毁掉函数,其中 arg 为需要校验的字段的值。
|
|
|
|
|
// 例:需要校验价格必须大于0.01
|
|
|
|
|
// {
|
|
|
|
|
// name:'price',
|
2023-07-05 18:24:32 +08:00
|
|
|
|
// rule:(arg: number) => arg > 0.01
|
2023-06-25 16:43:49 +08:00
|
|
|
|
// }
|
|
|
|
|
rule: (arg: any) => boolean
|
|
|
|
|
// 校验不通过时的消息提示
|
|
|
|
|
message: string
|
2023-06-24 01:48:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-08-28 18:56:37 +08:00
|
|
|
|
export { SkuList, PropertyAndValues, RuleConfig }
|