the merge project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.4 KiB

<template>
<div class="row grass-border" id="field">
<div :class="'crop-field '+(!field.data ? 'empty' : '')"
v-on:click="plant(field.id)"
4 years ago
v-on:contextmenu="cropInformation(field.id)"
v-for="field in fields"
v-bind:key="field.id">
{{ field.id }}
</div>
</div>
</template>
<script>
import Modal from 'bootstrap/js/src/modal'
export default {
name: "CropField",
computed: {
fields() {
return this.$store.state.cropField;
}
},
methods: {
plant(id) {
this.$store.commit('selectField', id);
const modal = new Modal(document.getElementById('cropInventoryModal'))
modal.toggle();
4 years ago
},
cropInformation(id) {
this.$store.commit('selectField', id);
if (!this.$store.getters.selectedField.data) {
return false;
}
const modal = new Modal(document.getElementById('cropInformationModal'))
modal.toggle();
return false;
}
}
}
</script>
<style scoped>
#field {
margin: 1em 0.5em 6em 0.5em;
padding-bottom: 0;
background-color: #5A3C28;
align-content: center;
}
.crop-field {
width: 3.7em;
height: 3.7em;
border-radius: 14px;
background-image: url('@/assets/field/tile057.png');
background-repeat: no-repeat;
background-size: 100%;
margin: 3px auto;
}
</style>