Skip to content

Commit

Permalink
fix: mock数据在生产环境无法使用
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Dec 17, 2021
1 parent 16042d2 commit c154d1e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { setupAntd, setupDirectives, setupGlobalMethods, setupCustomComponents }

import permission from '@/core/permission/';

if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('./mock');
mockXHR();
}

const app = createApp(App);

// 全局挂载Reflect反射对象
Expand Down
3 changes: 2 additions & 1 deletion src/mock/hero/heroList.json
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,8 @@
"cname": "马超",
"new_type": 0,
"hero_type": 1,
"hero_type2": 4
"hero_type2": 4,
"skin_name": "冷晖之枪|幸存者|神威"
},
{
"title": "幻纱之灵",
Expand Down
4 changes: 4 additions & 0 deletions src/styles/antdv.override.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ body {
vertical-align: 0.125em !important;
}
}

.ant-image-preview-root img {
display: unset;
}
13 changes: 8 additions & 5 deletions src/views/shared/demos/tables/wzry-table/columns.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { TableColumn } from '@/components/dynamic-table';
import { Avatar, Tag } from 'ant-design-vue';
import { Image, Tag } from 'ant-design-vue';

export const columns: TableColumn[] = [
{
title: '头像',
align: 'center',
width: 100,
dataIndex: 'heroimg',
bodyCell: ({ record }) => <Avatar src={record.heroimg} />,
dataIndex: 'faceimg',
bodyCell: ({ record }) => <Image src={record.faceimg} />,
},
{
title: '英雄名称',
Expand All @@ -30,15 +30,18 @@ export const columns: TableColumn[] = [
dataIndex: 'skin_name',
bodyCell: ({ record }) => (
<>
{record.skin_name.split('|').map((name) => (
<Tag color={'blue'}>{name}</Tag>
{record.skin_name?.split('|')?.map((name) => (
<Tag color={'blue'} key={name}>
{name}
</Tag>
))}
</>
),
},
{
title: '操作',
align: 'center',
width: 120,
dataIndex: '$action',
actions: ({ record }) => [
{
Expand Down

0 comments on commit c154d1e

Please sign in to comment.