npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

label-making-print-vue3

v1.7.7

Published

标签制作与打印

Readme

标签制作与打印组件(label-making-print-vue3)

项目介绍

vue3版的标签制作与打印组件,可自定义标签元素与样式,拖拽式添加元素与调整元素位置,支持预览、打印(附件上传打印、递增打印),根据内容自动分页,利用CLodop打印插件可实现无预览直接打印(静默打印)。 标签制作界面

软件架构

技术栈:Vue 3 + TypeScript + Vite + Pinia + CLodop + ElementPlus

演示地址

http://cdxming.com/label/

使用教程

  1. 打印插件安装
    CLodop官网:http://www.c-lodop.com/download.html
  2. 安装插件与图标:
    npm install label-making-print-vue3  
    npm install @element-plus/icons-vue  
    npm install element-plus
  3. 全局注册插件与图标:
    import ElementPlus from 'element-plus'
    import 'element-plus/dist/index.css'
    import * as ElIcons from '@element-plus/icons-vue'
    import LabelMakingPrint from 'label-making-print-vue3'  
    import 'label-making-print-vue3/label-making-print-vue3.css'  
    
    const app = createApp(App)  
    for (const [key, component] of Object.entries(ElIcons)) {
        app.component(key, component)
    }
    app.use(ElementPlus, { zIndex: 3000 })
    app.use(LabelMakingPrint)  
  4. 使用编辑器组件
    <template>
        <div style="height: 100%;">
            <LabelMaking :data="editParams" :clodopKey="clodopKey" :showGoback="true" @saveELementList="saveELementList" @updateTableElement="updateTableElement" @deleteElement="deleteElement" @goback="goback">
                <template #subTitle>
                    副标题
                </template>
            </LabelMaking>
        </div>
    </template>
    
    <script lang="ts" setup>
    import type { ElementParams, TableColumnParams, MakingParams, ClodopKey } from 'label-making-print-vue3'
    import { ref } from 'vue'
    
    const editParams = ref<MakingParams>({
        elements: [],
        template: {
            width: 100,
            height: 100,
            direction: false,
            angle: 0,
            sizeType: 'custom'
        }
    })
    const clodopKey = ref<ClodopKey>({ // CLODOP打印插件的密钥,如果没有,可以不配置,但打印结果会有水印
        secretName: '',
        secretKey: ''
    })
    // 保存元素
    const saveELementList = (elementList: ElementParams[]) => {
        console.log(elementList)
    }
    // 表格元素删除行、列,合并单元格的更新
    const updateTableElement = (item: {delIds: (string | number)[], updateElement: TableColumnParams[]}) => {
        console.log(item)
    }
    // 删除元素
    const deleteElement = (id: string | number) => {
        console.log(id)
    }
    // 返回
    const goback = () => {
        console.log('返回上一页')
    }
    </script>
  5. 使用打印组件
    <template>
        <div style="height: 100%;">
            <el-select v-model="params.printer" placeholder="选择打印机" style="width: 300px;">
                <el-option value="Microsoft Print to PDF" label="Microsoft Print to PDF" />
            </el-select>
            <el-button @click="print">print</el-button>
            <el-button @click="preview">preview</el-button>
            <LabelPrint ref="labelPrintRef" :data="params" :clodopKey="clodopKey" @printFail="errorMsg" @printSuccess="successMsg" />
        </div>
    </template>
    
    <script lang="ts" setup>
    import type { printParams, ClodopKey } from 'label-making-print-vue3'
    import { ref } from 'vue'
    
    const labelPrintRef = ref()
    const clodopKey = ref<ClodopKey>({ // CLODOP打印插件的密钥,如果没有,可以不配置,但打印结果会有水印
        secretName: '',
        secretKey: ''
    })
    const params = ref<printParams>({
        name: 'test',
        printType: 'preview',
        printer: '',
        labelParamsTotal: [{
            elements: [
                {
                    "id": "7ad13e927a7d49f7bd55d99f67e11447",
                    "type": "TEXT",
                    "loadingPriority": 1,
                    "description": "文本",
                    "content": "文本",
                    "testContent": "文本",
                    "imageFileURL": "",
                    "qrcodeLogo": "",
                    "fontName": "宋体",
                    "fontSize": 12,
                    "fontWeight": false,
                    "fontItalic": false,
                    "textDecoration": [],
                    "fontSpacing": 0,
                    "fontColor": "#000000",
                    "textAlign": "left",
                    "positionX": 160,
                    "positionY": 101,
                    "relativeElementX": "",
                    "relativeElementY": "",
                    "color": '#000000',
                    "width": 1,
                    "height": 1,
                    "imageWidth": 0,
                    "imageHeight": 0,
                    "barWidth": 1,
                    "barHeight": 30,
                    "barLeftMargin": 1,
                    "barRightMargin": 1,
                    "barTopMargin": 1,
                    "barBottomMargin": 1,
                    "barBackground": "rgba(255, 255, 255, 0)",
                    "barLineColor": "#000000",
                    "qrCorrectLevel": "L",
                    "row": 4,
                    "column": 4,
                    "angle": 0,
                    "widthAlignElement": "",
                    "heightAlignElement": "",
                    "firstRowBackground": "rgba(255, 255, 255, 0)",
                    "oddNumberRowBackground": "rgba(255, 255, 255, 0)",
                    "evenNumberRowBackground": "rgba(255, 255, 255, 0)",
                    "tableBorder": true
                },
            ],
            template: {
                name: '测试模板',
                width: 100,
                height: 100,
                direction: false,
                angle: 0,
                sizeType: 'custom'
            }
        }]
    })
    // 打印
    const print = () => {
        params.value.printType = 'print'
        labelPrintRef.value.print()
    }
    // 预览
    const preview = () => {
        params.value.printType = 'preview'
        labelPrintRef.value.preview()
    }
    // 打印失败的回调
    const errorMsg = (msg: string) => {
        console.log(msg)
    }
    // 打印成功的回调
    const successMsg = () => {
        console.log('打印成功')
    }
    </script>

联系方式

QQ:281323984