0.0.3 • Published 2 years ago

gisq-hb-file-lib v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

###0.0.1 发布

 
npm publish --registry http://registry.npmjs.org

小demo

<script>
// This starter template is using Vue 3 <script setup> SFCs
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
import HelloWorld from './components/HelloWorld.vue'
import {gisqDownLoadHbLib} from "../gisq/fileLib/fileUtil.js"
export default {
  components: {
    HelloWorld,
    gisqDownLoadHbLib
  },
  data(){
	  return {
		  
	  }
  },
  methods:{
	  down:function(){
		  var downloadLib=new gisqDownLoadHbLib({
		  	path:"http://snip.qq.com/resources/Snip_V2.0_5771.dmg",
		  	method:"GET",
		  	complete:function(filepath){
		  		console.log( "下载complete:", filepath);
				var finalPath=downloadLib.convertLocalFileFormHbUrl(filepath);
				console.log(finalPath)
				/* downloadLib.readLocalFileHbUrl(finalPath,function(entry){
					entry.file( function(file){
								var fileReader = new plus.io.FileReader();
								console.log("getFile:" + JSON.stringify(file)); */
								/* fileReader.readAsText(file, 'utf-8');
								fileReader.onloadend = function(evt) {
									console.log("11" + evt);
									console.log("evt.target" + evt.target);
									console.log(evt.target.result);
								} */
								/* console.log(file.size + '--' + file.name);
							} );
				},function(e){
					
				}) */
		  	},
		  	error:function(url){
		  		
		  	},
		  	start:function(){
		  		
		  	},
		  	connected:function(){
		  		
		  	},
		  	downloading:function(downsize,totalsize){
				var precent=(downsize/totalsize)*100;
		  		console.log( downsize+"/"+totalsize,precent);
		  	},
		  	finish:function(totalsize){
		  		console.log( "下载finish:", totalsize);
		  	}
		  });
		  downloadLib.startDownloadTask();
	  }
  },
  mounted:function(){
	  var _this=this;
	  if(window.plus){  
	      // 在这里调用5+ API  
		  this.down();
	  }else{// 兼容老版本的plusready事件  
	      document.addEventListener('plusready',function () {  
	          // 在这里调用5+ API  
			  _this.down()
	      },false);  
	  }  
	  
	  
	  
  }
  // ...
}

</script>

<template>
  <img alt="Vue logo" src="./assets/logo.png" />
  <HelloWorld msg="Hello Vue 3 + Vite" />
</template>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>