-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #18 Allow raw file data in VueFilePreview
- Loading branch information
Showing
6 changed files
with
137 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<!-- {% raw %} --> | ||
<div class="bg-light"> | ||
<span :key="ext" v-for="(color, ext) in icons" style="width: 42px; height: 42px; display: inline-block;" :style="{color: color}"> | ||
<VueFileIcon :ext="ext" style="width: 100%; height: 100%; fill: currentColor;"></VueFileIcon> | ||
</span> | ||
</div> | ||
<!-- {% endraw %} --> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data: function(){ | ||
return { | ||
icons: { | ||
pdf: 'red', | ||
doc: 'blue', | ||
ods: 'green', | ||
zip: 'orange', | ||
db: 'brown', | ||
} | ||
}; | ||
}, | ||
methods: { | ||
}, | ||
mounted: function(){ | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<template> | ||
<!-- {% raw %} --> | ||
<div class="theme-default"> | ||
<div class="vue-file-agent grid-block-wrapper" style="padding: 0;"> | ||
<template v-for="(fileData, i) in filesData"> | ||
<VueFilePreview :key="i" :value="fileData" class="file-preview-wrapper grid-box-item grid-block"></VueFilePreview> | ||
</template> | ||
</div> | ||
</div> | ||
<!-- {% endraw %} --> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
data: function(){ | ||
return { | ||
filesData: this.getFilesDataInitial(), | ||
}; | ||
}, | ||
methods: { | ||
getFilesDataInitial: function(){ | ||
var filesBaseUrl = window.location.host == 'localhost:4000' ? '/vue-file-agent/website/assets/files/' : 'https://safrazik.github.io/vue-file-agent/website/assets/files/'; | ||
var videoData = {"name":"Cat Licking Its Paw.mp4","lastModified":1565241222998,"sizeText":"433 KB","size":443767,"type":"video/mp4","ext":"mp4", "dimensions": {"width": 640, "height": 360}}; | ||
videoData.videoThumbnail = filesBaseUrl + '/Cat Licking Its Paw-thumb.png'; | ||
videoData.imageColor = [66, 62, 45]; | ||
var filesData = []; | ||
[ | ||
{"name":"sample.pdf","lastModified":1565232623243,"sizeText":"3 KB","size":3028,"type":"application/pdf","ext":"pdf"}, | ||
{"name":"DSC_0261.jpg","lastModified":1564648335292,"sizeText":"64 KB","size":65762,"type":"image/jpeg","ext":"jpg"}, | ||
{"name":"Important sheet.ods","lastModified":1564392646095,"sizeText":"31 KB","size":31276,"type":"","ext":"ods"}, | ||
videoData, | ||
{"name":"Collection of something.zip","lastModified":1564392646087,"sizeText":"2 MB","size":1640378,"type":"application/x-zip-compressed","ext":"zip"}, | ||
{"name":"Document 3.doc","lastModified":1564392646097,"sizeText":"109 KB","size":111303,"type":"","ext":"doc"}, | ||
].forEach(function(fd){ | ||
fd.url = filesBaseUrl + fd.name; | ||
// fd.progress = 10; | ||
filesData.push(fd); | ||
}); | ||
return filesData; | ||
}, | ||
}, | ||
mounted: function(){ | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters