gisq-hb-mobile-upload-v3
v0.0.6
Published
``` npm install ```
Downloads
3
Maintainers
Readme
default
Project setup
npm install
Compiles and hot-reloads for development
npm run serve
Compiles and minifies for production
npm run build
Run your tests
npm run test
Lints and fixes files
npm run lint
dependencies
"v-viewer": "^3.0.10",
"viewerjs": "^1.9.0"
Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
1 如果没有安装v-viewer
请执行 npm install v-viewer@next
2 main.js中
const app=createApp(App);
app.use(Viewer,{
defaultOptions: {
zIndex: 9999
}
})
应用中使用组件
import {GisqUpload} from "gisq-hb-mobile-upload-v3"
import 'viewerjs/dist/viewer.css'
import 'gisq-hb-mobile-upload-v3/dist/style.css'
npm publish
小demo
<script setup>
import {
ref,
onMounted
} from 'vue'
import 'viewerjs/dist/viewer.css'
import '../../dist/style.css'
import {
GisqUpload
} from '../../dist/gisqUpload.es.js'
var testSrc;
var files = [];
//showFiles:[],
var showFiles = ["file://video/1.png", "file://video/2.png"]
/* testSrc:null,
files :["file://video/1.png", "file://video/2.png"];
//showFiles:[],
showFiles:["file://video/1.png", "file://video/2.png"] */
let onCustomPrewer = function(src) {
console.log(1111111333);
};
let onChange = function(fileMap) {
console.log("onChange")
for (let key of fileMap.keys()) {
//alert("dddd="+fileMap.get(key).lastModifiedDate)
console.log(key)
}
};
let onAdded = function(path, fileObj) {
console.log("onAdded=" + path)
console.log(fileObj)
files.push(fileObj);
};
let onDeletedX = function(path) {
console.log("onDeleted")
console.log(path)
onDeleted(path, files)
};
let onDeleted = function(path, fileList) {
console.log("onDeleted")
console.log(path)
fileList.forEach((item, index) => {
if (item.name == path) {
let index = fileList.indexOf(item)
fileList.splice(index, 1)
}
})
console.log(files)
};
let onBeforeAdded = function(path) {
console.log("onBeforeAdded")
console.log(path)
};
let onBeforeDeleted = function(path) {
console.log("onBeforeDeleted")
console.log(path)
};
let toTakePic = function() {
//this.$router.replace({path:'/takePic',name:"takePic"});
//this.$router.push('/takePic')
showFiles = [];
//this.$forceUpdate()
};
let testGetInfo = function() {
console.log(GisqUpload)
GisqUpload.getDeviceInfo(function(info) {
console.log(JSON.stringify(info))
})
var path = "file:///sdcard/gisqmap/161776021489153.jpeg";
GisqUpload.readLocalFile(path, function(fileJs, jsBlob) {
testSrc = jsBlob;
});
};
let mounted = function() {
};
onMounted(() => {
mounted();
})
</script>
<template>
<h1>{{ msg }}</h1>
<gisq-upload @onChange="onChange" @onAdded="onAdded"
@onBeforeAdded="onBeforeAdded" @onBeforeDeleted="onBeforeDeleted"
@onDeleted="onDeletedX" :files="showFiles"></gisq-upload>
</template>
<style scoped>
a {
color: #42b983;
}
</style>