Files
FirstUI-vue/pages/component/canvas/barcode/barcode.vue
2023-08-17 21:28:49 +08:00

75 lines
1.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!--本文件由FirstUI授权予新疆天衡创新研究院有限公司手机号1 8 6 1 40 7 25 49身份证尾号5A07X5专用请尊重知识产权勿私下传播违者追究法律责任-->
<template>
<view class="fui-wrap">
<view class="fui-page__hd">
<view class="fui-page__title fui-align__center" @tap="vip">Barcode <image
src="/static/images/index/light/icon_member_3x.png"></image>
</view>
<view class="fui-page__desc">Barcode 条形码用于展现条形码信息</view>
</view>
<view class="fui-page__bd">
<view class="fui-input__box">
<fui-input v-model="val" maxlength="13" type="number"></fui-input>
<view class="fui-tips">请输入13位条码信息扫描只能识别有效的条形码</view>
</view>
<fui-button type="gray" btn-size="medium" text="生成" bold :margin="['32rpx','0','64rpx']"
@click="barcode">
</fui-button>
<fui-barcode ref="barcode" :value="val"></fui-barcode>
</view>
</view>
</template>
<script>
export default {
data() {
return {
val: '6937147252044'
}
},
onReady() {
setTimeout(() => {
this.barcode()
}, 50)
},
methods: {
vip() {
this.fui.href("/pages/my/qa/qa?index=2&title=VIP专属内容")
},
barcode() {
//输入框如果type=number 则返回的是Number类型值
if (String(this.val).length === 13) {
this.$refs.barcode.draw()
} else {
this.fui.toast('请输入13位条形码')
}
}
}
}
</script>
<style>
.fui-wrap {
padding-bottom: 64rpx;
}
.fui-page__bd {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.fui-input__box {
width: 100%;
}
.fui-tips {
width: 100%;
font-size: 24rpx;
color: #7F7F7F;
font-weight: 400;
padding: 24rpx;
box-sizing: border-box;
}
</style>