一、css
二、方法
uniApp
1、动态修改头部标题
uni.setNavigationBarTitle({
title: this.dynamicTitle,
success: () => {
console.log('修改标题成功')
},
fail: () => {
console.log('修改标题失败')
},
complete: () => {
console.log('修改标题结束')
}
})
2、预览图片单张/多张(拖动缩放),识别https
uni.previewImage({
// 需要预览的图片链接列表
urls: [res.tempFilePath],
// 为当前显示图片的链接/索引值
current: res.tempFilePath,
// 图片指示器样式
indicator:'default',
// 是否可循环预览
loop:false
});
3、获取图片的详细信息
uni.getImageInfo({
src: '/static/bg_icon.png', // 图片地址
success(res) {
console.log(res.path)
}
})
4、将画布内容生成临时文件路径
uni.canvasToTempFilePath({
canvasId: 'canvas1',
success: (res) => {
console.log(res.tempFilePath)
},
fail: (res) => {
// 失败
}
})
5、文件下载
uni.downloadFile({
url: 'https://open-laser.oss-cn-shanghai.aliyuncs.com/ab965f82ebc64f92bd2f3d53c595bfb0.jpg',
success: (res)=>{
console.log(res.tempFilePath)
}
})
6、文件上传
uni.uploadFile({
url: 'https://open-laser.oss-cn-shanghai.aliyuncs.com/ab965f82ebc64f92bd2f3d53c595bfb0.jpg',
success: (res)=>{
console.log(res.tempFilePath)
}
})
7、保存图片
uni.saveImageToPhotosAlbum({
filePath: '../static/icon.png',
success(res) {
uni.showToast({
icon: 'success',
mask: true,
title: '保存成功',
});
},
fail(res) {
console.log(res.errMsg)
}
})
8、模块的拖动双指缩放
<template>
<movable-area v-if="person.isShowExam" @click.stop="person.isShowExam=!person.isShowExam">
<movable-view direction="all" @scale="onScale" scale scale-min="0.5" scale-max="4" >
<!-- 内容 -->
</movable-view>
</movable-area>
<view @click.stop="person.isShowExam=true">预览</view>
</template>
<script setup>
import { reactive } from 'vue'
let person=reactive({
isShowExam:false
})
</script>
<style lang="scss" scoped>
movable-area {
position: fixed;
top: 0;
left: 0;
width: 375px;
height: 100vh;
background: #000;
overflow: hidden;
z-index: 9999;
movable-view {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
}
}
</style>
小程序
希望我的愚见能够帮助你哦~,若有不足之处,还望指出,你们有更好的解决方法,欢迎大家在评论区下方留言支持,大家一起相互学习参考呀~