Skip to content

Commit f302fa0

Browse files
authored
Merge pull request Nativescript-Vue-Web#142 from Nativescript-Vue-Web/bugfix/myilmaz-img-src-convert-to-computed
src converted to computed value from data
2 parents 40f5ee9 + d928865 commit f302fa0

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/components/Img.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<img @error="$emit('onLoadError', $event)" v-common-directive :src="imageSrc" :class="stretchClass" :width="width" :height="height" />
2+
<img @error="$emit('onLoadError', $event)" v-common-directive :src="imageSrc" :class="stretchClass" :width="width" :height="height" />
33
</template>
44

55
<script>
@@ -18,12 +18,10 @@ export default {
1818
width: [String, Number],
1919
height: [String, Number],
2020
},
21-
data() {
22-
return {
23-
imageSrc: `${this.src.replace('~', '')}`,
24-
};
25-
},
2621
computed: {
22+
imageSrc: function() {
23+
return this.src.replace('~', '');
24+
},
2725
stretchClass: function() {
2826
return `nvw-img ${this.stretch !== 'none' ? 'nvw-img--' + camelCaseToDash(this.stretch) : ''}`.trim();
2927
},

0 commit comments

Comments
 (0)