in mt nativescript-vue app I'm suing RadListView to show a list of review with loadOnDemand enabled, everything works except for when I tap an item, when I tap I want to get 'title' property of tapped item but instead I get undefined in console.
(在mt nativescript-vue应用程序中,我使用RadListView来显示启用了loadOnDemand的评论列表,除了点击项目时一切正常,当我点击时我想获取被点击项目的'title'属性,但我却未定义在控制台中。)
This is my code:
(这是我的代码:)
<template>
<RadListView ref="listView" for="review in reviews" @itemTap="onItemTap(item)" loadOnDemandMode="Auto" @loadMoreDataRequested="onLoadMoreDataRequested" loadOnDemandBufferSize="2">
<v-template>
<GridLayout columns="auto,*" rows="auto,auto,auto" style="width:100%; height:auto; margin:0px 0px 10px 0px; padding:20px; background-color:white;" >
<Image row="0" col="0" :src="review.image" loadMode="async" stretch="fill" style="width:55px; height:55px; border-radius:50%; margin:0px 20px 0px 0px;"></Image>
<StackLayout row="0" col="1" orientation="horizontal" style="width:100%; height:20px; ">
<Label :text="'fa-star' | fonticon" class="fa" v-for="star in review.rating" fontSize="12" :key="star" style="color:rgb(244,227,73); margin:0px 1px 0px 0px; vertical-align:center;"></Label>
<Label text="hace 3 horas" class="fa c_grey" style="margin:0px 0px 0px 10px; vertcal-align:center;"></Label>
</StackLayout>
<Label row="1" col="1" class="c_normal fs_smaller" textWrap="true" style="margin:0;" lineHeight="0" :text="review.body"></Label>
</GridLayout>
</v-template>
</RadListView>
</template>
<script >
import { ObservableArray } from 'tns-core-modules/data/observable-array';
export default {
name:'ReviewCardCard',
data(){
return{
reviews: new ObservableArray
([
{ title:'Titulo 1', image:'~/assets/images/gloria-1.jpg', body:'I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position.', rating:5 },
{ title:'Titulo 2', image:'~/assets/images/gloria-1.jpg', body:'I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position.', rating:4 },
{ title:'Titulo 3', image:'~/assets/images/gloria-1.jpg', body:'I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position.', rating:3 },
{ title:'Titulo 4', image:'~/assets/images/gloria-1.jpg', body:'I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position.', rating:5 },
{ title:'Titulo 5', image:'~/assets/images/gloria-1.jpg', body:'I have not tried iOS yet. This may not be the best approach either. I am attempting to make a crop-box. In the view the user will see an image under the clip-path that they will position.', rating:4 },
])
}
},
methods:
{
onItemTap(item)
{
console.log(item);
},
onLoadMoreDataRequested()
{
console.log('load more');
}
}
</script>
<style scoped>
</style>
ask by gabogabans translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…