2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Download clientelas
NPM install print-js --save
inducere
import printJS from 'print-js'
- <el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
-
- <span slot="footer" class="dialog-footer">
- <span>{{ form.address }}</span>
- <span>{{ form.name }}</span>
- <span>{{ form.password }}</span>
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- <el-button type="primary" @click="share(form)">复制</el-button>
- <el-button type="primary"
- @click="printFnc('https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641', 'jpeg')">打印</el-button>
- </span>
- </el-dialog>
Modus printFnc in duobus parametris transit, inscriptionis fasciculi et fasciculi typus
- printFnc(url, filetype) {
- let path = url
- let type = ''
- const acceptedFileTypes = ['png', 'jpeg', 'jpg', 'gif']
- if (acceptedFileTypes.includes(filetype)) {
- type = 'image'
- } else {
- type = filetype
- }
- printJS({
- printable: path,
- type: type,
- // showModal: true,//开启加载modal
- onErrorL: (err) => {
- return this.$message({
- type: "error",
- message: '打印失败,请检查打印机设置或尝试保存文件!'
-
- })
- }
- })
- },