Learning.vue
<template>
<div>
<button @click="test()">test</button>
</div>
</template>
<script>
import records from './records.js'
export default {
data () {
return {
items1: records.data.info,
items2:
{
logId: 1,
logDetail: "This is some log detail for log 1",
logType: "general",
createdBy: "name",
createdAt: "date",
},
}
},
methods:{
test(){
console.log(this.items1.logId)
console.log(this.items2.logId)
}
}
}
</script>
records.js
export default {
data() {
return {
info: {
logId: 1,
logDetail: "This is some log detail for log 1",
logType: "general",
createdBy: "name",
createdAt: "date",
},
};
},
};
Although I can access logitems2, I am facing difficulties accessing the data in logitems1, even though they contain similar information. My challenge lies in accessing data from external files other than components.