Это computed
return this.getProject.map(i => {
this.$route.params == i.id
console.log(i.id)
})
if(this.$route.params.id == i.id) {
alert('1')
} else {
alert('2')
}
// this.$route.params == i.id
console.log(i.id)
})
{
path: '/project/:id',
name: 'project',
component: Project,
props: true
}
router-link(:to="`/project/${project.id}`" v-for="project in item.projects"
export default {
name: 'Project',
data() {
return {
}
},
computed: {
...mapGetters({
getProject: 'desktop/getProject'
}),
filtered(){
if(this.$router.prams.id== this.getProject.id) {
return this.getProject
} else {
return alert('1')
}
}
},
mounted() {
/*eslint-disable*/
console.log(this.getProject)
}
}
filtered(){
if(this.$route.params == this.getProject.id) {
return this.getProject
} else {
return alert("нененен")
}
}
this.$router.prams.id
Cannot read property 'id' of undefined"
this.$route.params
:to="`/project/${project.id}`, <b>params: {id: project.id}}</b>
invalid expression: Unexpected token : in
`/project/${project.id}`, params: {{id: project.id}} }
Raw expression: :to="`/project/${project.id}`, params: {{id: project.id}} }"
context.state.modalContractorsHistory = {
call: [
{
date: '06.05.18',
persons: [
{
name: 'Александра Скабичевская',
calls: [
{
number: '8(843) 254 31 51' ,
type: 'out',
time: '05:34'
}
]
},
{
name: 'Губка Бот',
calls: [
{
number: '8(999) 354 55 55' ,
type: 'fail',
time: '01:22'
}
]
}
]
},
{
date: '01.10.19',
persons: [
{
name: 'Ken TamovKen TamovKen TamovKen TamovKen Tamov',
calls: [
{
number: '8(843) 211 11 11',
type: 'in',
time: '02:34'
}
]
}
]
}
]
}
context.commit('GET_MODALCONTRACTORSHSITORY')
}
callIn() {
let persons = this.calls.flatMap(i => i.persons)
let allCalls = persons.flatMap(i => i.calls)
let newOut = allCalls.filter(item => item.type == 'in')
console.log(newOut)
return newOut
}