mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-29 12:41:10 -04:00
init crater
This commit is contained in:
71
resources/assets/js/views/components/ImageRadio.vue
Normal file
71
resources/assets/js/views/components/ImageRadio.vue
Normal file
@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<div class="form-group image-radio">
|
||||
<div
|
||||
v-for="(pdfStyleList, index) in pdfStyleLists"
|
||||
:key="index"
|
||||
class="radio"
|
||||
>
|
||||
<label :for="pdfStyleList.val">
|
||||
<input
|
||||
v-model="checkedID"
|
||||
:value="pdfStyleList.val"
|
||||
:id="pdfStyleList.val"
|
||||
:checked="pdfStyleList.val == checkedID"
|
||||
type="radio"
|
||||
name="pdfSet"
|
||||
class="hidden"
|
||||
>
|
||||
<img
|
||||
:src="srcMaker(pdfStyleList.src)"
|
||||
alt="No Image"
|
||||
class="special-img"
|
||||
>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default{
|
||||
props: {
|
||||
currentPDF: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
pdfStyleLists: [
|
||||
{src: 'assets/img/PDF/Invoice1.png', val: '1'},
|
||||
{src: 'assets/img/PDF/Invoice2.png', val: '2'},
|
||||
{src: 'assets/img/PDF/Invoice3.png', val: '3'},
|
||||
{src: 'assets/img/PDF/Invoice4.png', val: '4'}
|
||||
],
|
||||
checkedID: ''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
checkedID (newID) {
|
||||
if (newID !== null) {
|
||||
this.$emit('selectedPDF', newID)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
setTimeout(() => {
|
||||
if (this.currentPDF === '') {
|
||||
this.checkedID = null
|
||||
} else {
|
||||
this.checkedID = this.currentPDF
|
||||
}
|
||||
}, 1000)
|
||||
},
|
||||
methods: {
|
||||
srcMaker (file) {
|
||||
var url = '/'
|
||||
var full = url + '' + file
|
||||
return full
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user