<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>
