108 lines
2.2 KiB
Vue
Raw Normal View History

<template>
<div class="snow-page">
<div class="snow-inner">
2025-01-13 15:00:14 +08:00
<a-row :gutter="24">
<a-col :span="15">
<div class="code-box">
<a-card v-for="item in codeList" :key="item.id" :title="item.docs" :style="{ width: '400px' }" hoverable>
<div class="card-content">
<draw-barcode :tag="item.tag" :text="item.text" :options="item.options" />
</div>
</a-card>
2025-01-09 20:34:07 +08:00
</div>
2025-01-13 15:00:14 +08:00
</a-col>
<a-col :span="9">
<a-scrollbar style="height: 625px; overflow: auto">
<CodeView :code-json="codeJson" style="width: 100%" />
</a-scrollbar>
</a-col>
</a-row>
</div>
</div>
</template>
<script setup lang="ts">
2025-01-09 20:34:07 +08:00
const codeList = ref([
{
id: 1,
2025-01-13 15:00:14 +08:00
tag: "svg",
2025-01-09 20:34:07 +08:00
text: "SnowAdmin",
docs: "CODE128-默认条形码",
options: {
format: "CODE128",
height: 100
}
},
{
id: 2,
2025-01-13 15:00:14 +08:00
tag: "svg",
2025-01-09 20:34:07 +08:00
text: "SnowAdmin",
docs: "自定义高度和颜色",
options: {
format: "CODE128",
height: 50,
background: "#f7f8fa",
lineColor: "#2962ff"
}
},
{
id: 3,
2025-01-13 15:00:14 +08:00
tag: "svg",
2025-01-09 20:34:07 +08:00
text: "SnowAdmin",
docs: "设置字体和倾斜",
options: {
format: "CODE128",
height: 100,
font: "fantasy",
fontOptions: "italic"
}
},
{
id: 4,
2025-01-13 15:00:14 +08:00
tag: "svg",
2025-01-09 20:34:07 +08:00
text: "SnowAdmin",
docs: "CODE39-商品条形码",
options: {
format: "CODE39",
height: 100
}
},
{
id: 5,
2025-01-13 15:00:14 +08:00
tag: "svg",
2025-01-09 20:34:07 +08:00
text: "6971318501227",
docs: "EAN13-商品条形码",
options: {
format: "EAN13",
height: 100
}
},
{
id: 6,
2025-01-13 15:00:14 +08:00
tag: "svg",
2025-01-09 20:34:07 +08:00
text: "123456789999",
docs: "UPC-商品条形码",
options: {
format: "UPC",
height: 100
}
}
]);
2025-01-13 15:00:14 +08:00
const codeJson = computed(() => JSON.stringify(codeList.value, null, "\t"));
</script>
2025-01-09 20:34:07 +08:00
<style lang="scss" scoped>
.code-box {
display: flex;
flex-wrap: wrap;
gap: $margin;
.card-content {
display: flex;
align-items: center;
justify-content: center;
height: 120px;
}
}
</style>