Added printReady selector

This commit is contained in:
Tiago Rascazzi
2022-01-08 14:44:28 -05:00
parent 7c48c13dce
commit 16b357e11e
4 changed files with 20 additions and 7 deletions

View File

@ -105,9 +105,10 @@ export default {
}
},
mounted() {
this.insertRequested()
if(this.export_id)
this.insertRequested()
else
this.searchRecipes('')
},
methods: {

View File

@ -107,7 +107,7 @@
<div class="col-12 order-1 col-sm-12 order-sm-1 col-md-6 order-md-2">
<div class="row">
<div class="col-12">
<img class="img img-fluid rounded" :src="recipe.image" style="max-height: 30vh" :alt="$t('Recipe_Image')" v-if="recipe.image !== null" />
<img class="img img-fluid rounded" :src="recipe.image" style="max-height: 30vh" :alt="$t('Recipe_Image')" v-if="recipe.image !== null" @load="onImgLoad" />
</div>
</div>
@ -246,6 +246,9 @@ export default {
this.start_time = moment().format("yyyy-MM-DDTHH:mm")
}
if(recipe.image === null) this.printReady()
this.recipe = this.rootrecipe = recipe
this.servings = this.servings_cache[this.rootrecipe.id] = recipe.servings
this.loading = false
@ -272,6 +275,14 @@ export default {
this.servings = this.servings_cache?.[e.id] ?? e.servings
}
},
printReady: function(){
const template = document.createElement("template");
template.id = "printReady";
document.body.appendChild(template);
},
onImgLoad: function(){
this.printReady()
},
},
}
</script>