|
2 | 2 | import type {
|
3 | 3 | CloudinaryUploadWidgetError,
|
4 | 4 | CloudinaryUploadWidgetResults,
|
5 |
| -} from "@cloudinary-util/types"; |
6 |
| -import type { MediaType } from "../src/runtime/components/CldProductGallery.vue"; |
| 5 | +} from '@cloudinary-util/types' |
| 6 | +import type { MediaType } from '../src/runtime/components/CldProductGallery.vue' |
7 | 7 |
|
8 |
| -const { url } = useCldImageUrl({ options: { src: "/cld-sample-5.jpg" } }); |
9 |
| -console.log(url); |
| 8 | +const { url } = useCldImageUrl({ options: { src: '/cld-sample-5.jpg' } }) |
| 9 | +console.log(url) |
10 | 10 |
|
11 | 11 | const { url: videoUrl } = useCldVideoUrl({
|
12 |
| - options: { src: "videos/mountain-stars" }, |
13 |
| -}); |
14 |
| -console.log(videoUrl); |
| 12 | + options: { src: 'videos/mountain-stars' }, |
| 13 | +}) |
| 14 | +console.log(videoUrl) |
15 | 15 |
|
16 |
| -const mediaAssets: { tag: string; mediaType?: MediaType }[] = [ |
17 |
| - { tag: "electric_car_product_gallery_demo" }, // by default mediaType: "image" |
18 |
| - { tag: "electric_car_product_gallery_demo", mediaType: "video" }, |
19 |
| - { tag: "electric_car_360_product_gallery_demo", mediaType: "spin" }, |
20 |
| -]; |
| 16 | +const mediaAssets: { tag: string, mediaType?: MediaType }[] = [ |
| 17 | + { tag: 'electric_car_product_gallery_demo' }, // by default mediaType: "image" |
| 18 | + { tag: 'electric_car_product_gallery_demo', mediaType: 'video' }, |
| 19 | + { tag: 'electric_car_360_product_gallery_demo', mediaType: 'spin' }, |
| 20 | +] |
21 | 21 |
|
22 |
| -const buttonId = "open-btn"; |
| 22 | +const buttonId = 'open-btn' |
23 | 23 |
|
24 |
| -const cldVideoRef = ref(); |
| 24 | +const cldVideoRef = ref() |
25 | 25 |
|
26 | 26 | const chapters = {
|
27 |
| - 0: "Chapter 1", |
28 |
| - 6: "Chapter 2", |
29 |
| - 9: "Chapter 3", |
30 |
| -}; |
| 27 | + 0: 'Chapter 1', |
| 28 | + 6: 'Chapter 2', |
| 29 | + 9: 'Chapter 3', |
| 30 | +} |
31 | 31 |
|
32 | 32 | const colors = {
|
33 |
| - accent: "#ff0000", |
34 |
| - base: "#00ff00", |
35 |
| - text: "#0000ff", |
36 |
| -}; |
| 33 | + accent: '#ff0000', |
| 34 | + base: '#00ff00', |
| 35 | + text: '#0000ff', |
| 36 | +} |
37 | 37 |
|
38 | 38 | const onResult = (results: CloudinaryUploadWidgetResults) => {
|
39 |
| - console.log("results", results); |
40 |
| -}; |
| 39 | + console.log('results', results) |
| 40 | +} |
41 | 41 | const onError = (
|
42 | 42 | error: CloudinaryUploadWidgetError,
|
43 |
| - results: CloudinaryUploadWidgetResults |
| 43 | + results: CloudinaryUploadWidgetResults, |
44 | 44 | ) => {
|
45 |
| - console.log("error", error); |
46 |
| - console.log("results", results); |
47 |
| -}; |
| 45 | + console.log('error', error) |
| 46 | + console.log('results', results) |
| 47 | +} |
48 | 48 | </script>
|
49 | 49 |
|
50 | 50 | <template>
|
51 |
| - <button :id="buttonId">Select Image or Video</button> |
| 51 | + <button :id="buttonId"> |
| 52 | + Select Image or Video |
| 53 | + </button> |
52 | 54 | <CldMediaLibrary
|
53 | 55 | api-key="12345"
|
54 | 56 | :button-id="buttonId"
|
@@ -90,7 +92,12 @@ const onError = (
|
90 | 92 | :on-error="onError"
|
91 | 93 | :on-result="onResult"
|
92 | 94 | >
|
93 |
| - <button type="button" @click="open">Upload an Image</button> |
| 95 | + <button |
| 96 | + type="button" |
| 97 | + @click="open" |
| 98 | + > |
| 99 | + Upload an Image |
| 100 | + </button> |
94 | 101 | </CldUploadWidget>
|
95 | 102 | <CldUploadButton
|
96 | 103 | upload-preset="nuxt-cloudinary-unsigned"
|
|
0 commit comments