![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
uni-app
记录uni-app混合开发的小笔记
Evan是一万
这个作者很懒,什么都没留下…
展开
-
uni-app把canvas的px像素使用rpx表示
小程序,移动端在设置canvas的位置的时候,因为cnavas默认是px像素,对于位置的设置很不方便,所以要把px转换为用rpx表示1、获取设备宽度const system = uni.getSystemInfoSync()2、单位换算,算出1rpx = 多少pxconst w = system.windowWidth / 7503、使用比如我要设置30rpx,则可以表为 30*w...原创 2022-02-23 15:32:55 · 1599 阅读 · 0 评论 -
uni-app的canvas设置文字居中对齐center
重点:ctx.fillText()的第二个参数是你画布canvas的宽度,不然不能居中对齐!!!!!!!!!!!!ctx.setTextAlign('center')ctx.fillText('文字', canvas总宽度px, y轴位置px)原创 2022-02-23 15:25:10 · 2504 阅读 · 3 评论 -
uni-app混合开发小程序蓝牙连接使用步骤
1、打开适配器,初始化蓝牙uni.openBluetoothAdapter(OBJECT)2、搜索蓝牙设备可以设置 services 来指定搜索设备uni.startBluetoothDevicesDiscovery(OBJECT)3、当找到蓝牙设备调用// 回调函数参数就是返回的蓝牙设备数组uni.onBluetoothDeviceFound(CALLBACK)4、获取设备信息uni.getBluetoothDevices({ success:(res)=>{原创 2022-01-19 16:43:53 · 3593 阅读 · 1 评论 -
基于uniapp与uview的upload结合canvas给图片添加水印
基于uniapp与uview的upload结合canvas给图片添加水印加定时器的原因主要是为了在获取到canvas画布的时候避免空白,不加定时器图片没来得及渲染就获取,导致空白问题。<template> <view class="container"> <u-upload :file-list="fileList" @on-choose-complete="handleListChanged" width="120" height="120" />原创 2022-01-19 16:15:12 · 1396 阅读 · 0 评论