Skip to content

Commit 4cc9eee

Browse files
committed
feat: add cacheVersion prop to Icon component
1 parent 231d5e7 commit 4cc9eee

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/components/primitives/Icon/Icon.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ export default {
1212
customSize: String,
1313
fill: {
1414
type: String,
15-
}
15+
},
16+
cacheVersion: {
17+
type: String,
18+
default: '1.0.0',
19+
},
1620
},
1721
setup(props) {
1822
const shouldIconClass = computed(() => !props.customSize && !props.customClass)
1923
// Only apply 100% size when bulma icon class is used
20-
const computedHeight = computed(() => !shouldIconClass.value ? props.customSize : "100%")
21-
const computedWidth = computed(() => !shouldIconClass.value ? props.customSize : "100%")
24+
const computedHeight = computed(() => (!shouldIconClass.value ? props.customSize : '100%'))
25+
const computedWidth = computed(() => (!shouldIconClass.value ? props.customSize : '100%'))
2226
return { computedHeight, computedWidth, shouldIconClass }
2327
},
2428
}
2529
</script>
2630

2731
<template>
28-
<span :class="[{'icon': shouldIconClass}, size]">
32+
<span :class="[{ 'icon': shouldIconClass }, size]">
2933
<svg :fill="fill" :height="computedHeight" :width="computedWidth" :class="[customClass]">
30-
<use :href="`/${bundle}.svg#${name}`" />
34+
<use :href="`/${bundle}.svg?v=${cacheVersion}#${name}`" />
3135
</svg>
3236
</span>
3337
</template>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Icon render correctly 1`] = `<span class="icon"><svg height="100%" width="100%" class=""><use href="/undefined.svg#undefined"></use></svg></span>`;
3+
exports[`Icon render correctly 1`] = `<span class="icon"><svg height="100%" width="100%" class=""><use href="/undefined.svg?v=1.0.0#undefined"></use></svg></span>`;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Image render correctly 1`] = `<figure class="image"><img class="img"></figure>`;
3+
exports[`Image render correctly 1`] = `<figure class="image figure"><img class="img"></figure>`;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Timeline render correctly 1`] = `<ol class="px-5 timeline"></ol>`;
3+
exports[`Timeline render correctly 1`] = `<ol class="timeline"></ol>`;

0 commit comments

Comments
 (0)