当前位置:网站首页>uni-app进阶之自定义【day13】
uni-app进阶之自定义【day13】
2022-07-18 00:33:00 【InfoQ】
const downloadTask = uni.downloadFile({
url: data.url,
// 接口调用成功
success: (downloadResult) => {
uni.hideLoading();
if (downloadResult.statusCode === 200) {
plus.runtime.install(downloadResult.tempFilePath, {
force: false
}, function() {
plus.runtime.restart();
}, function(e) {
console.error('install fail...');
});
}
},
// 接口调用失败
fail: (err) => {
uni.showToast({
icon:'none',
mask:true,
title: '安装失败,请重新下载',
});
},
// 接口调用结束
complete: () => {
downloadTask.offProgressUpdate(); //取消监听加载进度
}
});
//监听下载进度
downloadTask.onProgressUpdate(res => {
state.percent = res.progress;
});
// main.js
import initToast from "@/components/bocft-toast/initToast.js"
import showToast from "@/components/bocft-toast/bocft-toast.vue"
initToast(Vue);
Vue.component('show-toast',showToast);
<template>
<view>
<uni-zujian></uni-zujian><!-- 这里会显示一个五角星,并且点击后会自动亮星 -->
</view>
</template>
<script>
// 这里不用import引入,也不需要在components内注册uni-list组件。template里就可以直接用
export default {
data() {
return {
}
}
}
</script>
边栏推荐
猜你喜欢

PbootCMS search SQL注入漏洞

Cloud native - orchestration and management

鲲鹏代码迁移工具基础知识
![[user article] examples of P4 consolidation practice guide disassemble resolve](/img/43/fd68171e5223d0ec4af55fc208a7ac.png)
[user article] examples of P4 consolidation practice guide disassemble resolve

C # FTP dual network card problem

Windows install MySQL

Servlet+JDBC表白墙

Learning notes of JUC source code 2 - AQS sharing and semaphore, countdownlatch

Code compliance: five reasons why developers use helix QAC

进 /user/用户名/Library/Application Support/
随机推荐
[dry goods] how much do you know about MySQL infrastructure design?
Radiotap
一款强大的mock数据生成工具
wpa_supplicant @authenticate
Build intranet mail service through Qunhui Suite
[software testing] - a complete tutorial of postman interface testing tool
项目实战第二十一讲:平台商品库
Offline installation of MariaDB
Adn public welfare acceleration - jsdelivr NPM (domestic), a high-quality alternative to elmcdn
【FPGA】:ip核-----CIC滤波器
手机买股票开户哪家券商公司好?哪个更安全
Impact analysis: rubygems unauthorized access vulnerability (cve-2022-29176)
How should I design my blog? How to build a blog with good experience?
云原生—编排及管理
进阶C语言 - 结构体实现位段
SSH uses Socks5 proxy to connect to the remote server
关于阿里云经典网络的问题
wpa_ supplicant @authenticate
PAT乙级-B1005 继续(3n+1)猜想(25)【数组】
【干货】MySQL底层架构设计,你了解多少?