4
I found an excerpt of code that I didn’t understand what it does.
I searched but did not find an answer (or did not use the correct terms to search).
Code:
<div v-if="returnedObject" class="found-objects result">
<Object :object="returnedObject"> </Object>
</div>
Specific excerpt that I did not understand:
:object="returnedObject"
They asked me to put all the code Complete code
<template>
<div class="found-objects devolutions">
<div class="content">
<label class="titulo">Devolver objeto</label>
<hr />
<div class="flex-column-between">
<label>Entre com o código de devolução:</label>
<div class="flex-column-between">
<input type="text" class="input" v-model="devolutionCode" />
<button
type="button"
class="button is-success"
@click="returnObject()"
>
Devolver objeto
</button>
</div>
</div>
<hr v-if="returnedObject" />
<div v-if="returnedObject" class="found-objects result">
<Object :object="returnedObject"> </Object>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
devolutionCode: null,
returnedObject: null
};
},
methods: {
returnObject() {
let body = { devolutionCode: this.devolutionCode };
let config = {
headers: {
Authorization: "Bearer " + this.$store.state.token
}
};
this.axios
.patch("url", body, config)
.then(response => {
if (response.status === 200) {
debugger
alert("Objeto devolvido com sucesso");
let devolution = this.devolutionCode;
let devolutions;
let devolutionsStr = localStorage.devolutionsStr;
if (devolutionsStr && devolutionsStr !== "") {
devolutions = JSON.parse(devolutionsStr);
if (devolutions && devolutions.length > 0) {
let alreadyExistentDevolution = devolutions.filter(
devol => devol === devolution
);
if (
alreadyExistentDevolution &&
alreadyExistentDevolution.length === 0
) {
devolutions.push(devolution);
}
} else {
devolutions = [];
devolutions.push(devolution);
}
} else {
devolutions = [];
devolutions.push(devolution);
}
localStorage.devolutionsStr = JSON.stringify(devolutions);
this.goToReturnedObjects();
} else {
alert(
"Erro ao tentar devolver objeto. Por favor, tente novamente."
);
}
console.log(response);
this.loading = false;
// this.selectAddress(response.data.addressId, () => {
// this.$router.push("/endereco");
// });
// this.isLoading = false;
})
.catch(error => {
console.log(error);
alert("Erro ao tentar devolver objeto. Por favor, tente novamente.");
});
},
goToReturnedObjects() {
this.$router.push("/objetos-devolvidos");
}
}
};
</script>
Sounds like a syntax error to me.
– Augusto Vasques
@Try it If you upload the full html, you’ll surely get better answers.
– user12100
It would be good to give a little more context where you got this excerpt from. It’s probably not pure HTML. HTML has a tag called Object, but the syntax is not that of your example. There must be some intermediate technology processing the data before generating "true" HTML, or else this excerpt came from some layout mechanism that resembles HTML but will not be used by a normal browser.
– Bacco