feat: add web application
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { computed, h, ref } from 'vue';
|
||||
import { NImage } from 'naive-ui';
|
||||
import { FormSchema } from '@/components/Form';
|
||||
import { useDictStore } from '@/store/modules/dict';
|
||||
|
||||
const dict = useDictStore();
|
||||
|
||||
export const schemas = ref<FormSchema[]>([
|
||||
{
|
||||
field: 'name',
|
||||
component: 'NInput',
|
||||
label: '商品名称',
|
||||
componentProps: { clearable: true },
|
||||
},
|
||||
{
|
||||
field: 'categoryId',
|
||||
component: 'NSelect',
|
||||
label: '商品分类',
|
||||
componentProps: {
|
||||
options: computed(() => dict.getOptionUnRef('productCategoryOption')),
|
||||
clearable: true,
|
||||
placeholder: '请选择',
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
export const columns = [
|
||||
{ title: 'ID', key: 'id', width: 50 },
|
||||
{
|
||||
title: '图片',
|
||||
key: 'coverUrl',
|
||||
width: 90,
|
||||
render: (row) =>
|
||||
h(NImage, {
|
||||
src: row.coverUrl,
|
||||
width: 80,
|
||||
height: 70,
|
||||
objectFit: 'cover',
|
||||
lazy: true,
|
||||
}),
|
||||
},
|
||||
{ title: '名称', key: 'name', width: 145, ellipsis: { tooltip: true } },
|
||||
{ title: '商品价格', key: 'price', width: 90 },
|
||||
{ title: '店铺名称', key: 'shopName', width: 100, ellipsis: { tooltip: true } },
|
||||
{ title: '创建时间', key: 'createdAt', width: 125 },
|
||||
{
|
||||
title: '是否推荐',
|
||||
key: 'isRecommended',
|
||||
width: 90,
|
||||
render: (row) => (row.isRecommended === 1 ? '推荐' : '不推荐'),
|
||||
},
|
||||
];
|
||||
|
||||
export const loadOptions = () => dict.loadOptions(['productCategoryOption']);
|
||||
Reference in New Issue
Block a user