You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
522 B
Vue

<template>
<view class="network-print-page">
<button type="primary" @tap="linkPrint"></button>
</view>
</template>
<script setup>
uni.onSocketOpen(function (res) {
console.log('WebSocket连接已打开');
});
function linkPrint () {
uni.connectSocket({
url: 'ws://192.168.1.15',
method: 'CONNECT',
success: (res) => {
console.log('连接打印机成功', res)
},
fail: (error) => {
console.log('连接打印机失败', error)
}
})
}
</script>
<style lang="scss">
</style>