Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Vuetify在v-data-iterator中查找所选v-item的索引_Javascript_Vue.js_Web_Vuetify.js - Fatal编程技术网

Javascript Vuetify在v-data-iterator中查找所选v-item的索引

Javascript Vuetify在v-data-iterator中查找所选v-item的索引,javascript,vue.js,web,vuetify.js,Javascript,Vue.js,Web,Vuetify.js,我在v-col中包装了一排v-card,它们都被包装在一个v-data-itetator中,现在我遇到了两个问题 所选卡片的索引不反映数组中作为真相来源传递给道具项目的同一项目的索引。这会随着每页的变化而变化 当您在一个页面中单击一张卡时,位于相同位置但在连续页面中的另一张卡也会被选中 @{{item.handle} {{item.bio} {{item.following} 下列的 {{item.followers} 追随者 mdi帐户已分配多个支票 mdi推特 {{item.twee

我在v-col中包装了一排v-card,它们都被包装在一个v-data-itetator中,现在我遇到了两个问题

  • 所选卡片的索引不反映数组中作为真相来源传递给道具项目的同一项目的索引。这会随着每页的变化而变化

  • 当您在一个页面中单击一张卡时,位于相同位置但在连续页面中的另一张卡也会被选中

    
    @{{item.handle}
    {{item.bio}
    {{item.following}
    下列的
    {{item.followers}
    追随者
    mdi帐户已分配多个支票
    mdi推特
    {{item.tweets}}tweets
    mdi日历月概要
    加入
    {{item.joined}
    @{{item.handle}
    {{item.bio}
    {{item.following}
    下列的
    {{item.followers}
    追随者
    mdi帐户多个RemoveUnassigned
    mdi推特
    {{item.tweets}}tweets
    mdi日历月概要
    加入
    {{item.joined}
    
  • 我的vue实例如下所示

    export default {
      name:"App",
      components:{Playground},
      data() {
        return {
          avatarsPerPage: 4,
          avatarsPerPageArray: [4, 8, 12, 16, 20, 24, 28, 32,],
          search: "",
          filter: {},
          sortDesc: false,
          page: 1,
          sortByHandle: "handle",
          selected: [],
          assignDialog: false,
          team: [
            {
              id: 1,
              firstname: "Evanson ",
              lastname: "Mwangi",
              avatars: 120,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 2,
              firstname: "Marcus",
              lastname: "Mwangi",
              avatars: 320,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 3,
              firstname: "Mercy ",
              lastname: "Orangi",
              avatars: 620,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 4,
              firstname: "Millicent",
              lastname: "Achieng",
              avatars: 120,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 5,
              firstname: "Edward",
              lastname: "Kitili",
              avatars: 80,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 6,
              firstname: "Changaresi",
              lastname: "Mugamura",
              avatars: 60,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
             ...
            ],
            avatars: [
            {
              handle: "mwasyakyalo",
              bio: "Real distance trader | A woman of her word",
              following: 323,
              followers: 230,
              likes: 710,
              tweets: 3600,
              joined: "April 2010",
              profile: "/avatar-3.png",
              assigned: true,
            },
            {
              handle: "catemukami",
              bio: "Staunch Kikuyu | Lover of fine things",
              following: 324,
              followers: 710,
              likes: 300,
              tweets: 4300,
              joined: "April 2010",
              profile: "/avatar-4.png",
              assigned: true,
            },
            {
              handle: "mainakamandaelder",
              bio: "For the people by the people",
              following: 340,
              followers: 349,
              likes: 490,
              tweets: 1230,
              joined: "April 2010",
              profile: "/avatar-5.png",
              assigned: true,
            },
            {
              handle: "salmakambo",
              bio: "Maji yakimwagika hayazoleki | Leave the past to be ",
              following: 710,
              followers: 800,
              likes: 1020,
              tweets: 558,
              joined: "April 2010",
              profile:
                "https://pbs.twimg.com/profile_images/1277896115342528512/uNVpTeIW.jpg",
              assigned: false,
            },
            ],
            };
      },
      computed: {
        numberOfPages() {
          return Math.ceil(this.avatars.length / this.avatarsPerPage);
        },
        showAssign() {
          return this.selected.length > 0;
        },
        members() {
          const names = [];
          this.team.forEach((member) =>
            names.push(member.firstname + " " + member.lastname)
          );
          return names;
        },
        // filteredKeys() {
        //   return this.keys.filter((key) => key !== `Name`);
        // },
      },
      methods: {
        nextPage() {
          if (this.page + 1 <= this.numberOfPages) this.page += 1;
        },
        formerPage() {
          if (this.page - 1 >= 1) this.page -= 1;
        },
        updateAvatarsPerPage(number) {
          this.avatarsPerPage = number;
        },
        sortAscendingBy(prop) {
          this.avatars.sort((a, b) => (a[prop] < b[prop] ? -1 : 1));
        },
        sortDescendingBy(prop) {
          this.avatars.sort((a, b) => (a[prop] > b[prop] ? -1 : 1));
        },
        assign(e) {
          /**eslint-disable */
          console.log(e(this),this.selected);
        },
       },
     };
    
    导出默认值{
    名称:“应用程序”,
    组件:{操场},
    数据(){
    返回{
    阿凡达个人主页:4,
    avatarsPerPageArray:[4,8,12,16,20,24,28,32,,
    搜索:“,
    筛选器:{},
    sortDesc:错误,
    页码:1,
    sortByHandle:“句柄”,
    选定:[],
    对话:错,
    小组:[
    {
    id:1,
    名字:“伊万森”,
    姓氏:“Mwangi”,
    头像:120,
    createdAt:“2020年5月26日上午10:09”,
    追随者:780,
    以下:300,
    喜欢:600,
    推特:500,
    },
    {
    id:2,
    名字:“马库斯”,
    姓氏:“Mwangi”,
    化身:320,
    createdAt:“2020年5月26日上午10:09”,
    追随者:780,
    以下:300,
    喜欢:600,
    推特:500,
    },
    {
    id:3,
    名字:“仁慈”,
    姓氏:“Orangi”,
    头像:620,
    createdAt:“2020年5月26日上午10:09”,
    追随者:780,
    以下:300,
    喜欢:600,
    推特:500,
    },
    {
    id:4,
    名字:“米利森特”,
    姓:“阿城”,
    头像:120,
    createdAt:“2020年5月26日上午10:09”,
    追随者:780,
    以下:300,
    喜欢:600,
    推特:500,
    },
    {
    id:5,
    名字:“爱德华”,
    姓氏:“Kitili”,
    阿凡达:80,
    createdAt:“2020年5月26日上午10:09”,
    追随者:780,
    以下:300,
    喜欢:600,
    推特:500,
    },
    {
    id:6,
    名字:“昌加雷斯”,
    姓氏:“穆加穆拉”,
    阿凡达:60,
    createdAt:“2020年5月26日上午10:09”,
    追随者:780,
    以下:300,
    喜欢:600,
    推特:500,
    },
    ...
    ],
    化身:[
    {
    手柄:“mwasyakyalo”,
    个人简介:“真正的远程交易者|言而有信的女人”,
    以下:323,
    追随者:230,
    喜欢:710,
    推特:3600,
    加入:“2010年4月”,
    个人资料:“/avatar-3.png”,
    是的,
    },
    {
    手柄:“catemukami”,
    传记:“坚定的Kikuyu |美好事物的爱好者”,
    以下:324,
    追随者:710,
    喜欢:300,
    推特:4300,
    加入:“2010年4月”,
    个人资料:“/avatar-4.png”,
    是的,
    },
    {
    句柄:“mainakamandaelder”,
    个人简介:“为了人民,为了人民”,
    以下:340,
    追随者:349人,
    喜欢:490,
    推特:1230,
    加入:“2010年4月”,
    个人资料:“/avatar-5.png”,
    是的,
    },
    {
    手柄:“salmakambo”,
    简介:“Maji yakimwagika hayazoleki |让过去成为现实”,
    以下:710,
    粉丝:800人,
    喜欢:1020,
    推特:558,
    加入:“2010年4月”,
    轮廓:
    "https://pbs.twimg.com/profile_images/1277896115342528512/uNVpTeIW.jpg",
    赋值:false,
    },
    ],
    };
    },
    公司
    
    export default {
      name:"App",
      components:{Playground},
      data() {
        return {
          avatarsPerPage: 4,
          avatarsPerPageArray: [4, 8, 12, 16, 20, 24, 28, 32,],
          search: "",
          filter: {},
          sortDesc: false,
          page: 1,
          sortByHandle: "handle",
          selected: [],
          assignDialog: false,
          team: [
            {
              id: 1,
              firstname: "Evanson ",
              lastname: "Mwangi",
              avatars: 120,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 2,
              firstname: "Marcus",
              lastname: "Mwangi",
              avatars: 320,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 3,
              firstname: "Mercy ",
              lastname: "Orangi",
              avatars: 620,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 4,
              firstname: "Millicent",
              lastname: "Achieng",
              avatars: 120,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 5,
              firstname: "Edward",
              lastname: "Kitili",
              avatars: 80,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
            {
              id: 6,
              firstname: "Changaresi",
              lastname: "Mugamura",
              avatars: 60,
              createdAt: "May 26, 2020 10:09am",
              followers: 780,
              following: 300,
              likes: 600,
              tweets: 500,
            },
             ...
            ],
            avatars: [
            {
              handle: "mwasyakyalo",
              bio: "Real distance trader | A woman of her word",
              following: 323,
              followers: 230,
              likes: 710,
              tweets: 3600,
              joined: "April 2010",
              profile: "/avatar-3.png",
              assigned: true,
            },
            {
              handle: "catemukami",
              bio: "Staunch Kikuyu | Lover of fine things",
              following: 324,
              followers: 710,
              likes: 300,
              tweets: 4300,
              joined: "April 2010",
              profile: "/avatar-4.png",
              assigned: true,
            },
            {
              handle: "mainakamandaelder",
              bio: "For the people by the people",
              following: 340,
              followers: 349,
              likes: 490,
              tweets: 1230,
              joined: "April 2010",
              profile: "/avatar-5.png",
              assigned: true,
            },
            {
              handle: "salmakambo",
              bio: "Maji yakimwagika hayazoleki | Leave the past to be ",
              following: 710,
              followers: 800,
              likes: 1020,
              tweets: 558,
              joined: "April 2010",
              profile:
                "https://pbs.twimg.com/profile_images/1277896115342528512/uNVpTeIW.jpg",
              assigned: false,
            },
            ],
            };
      },
      computed: {
        numberOfPages() {
          return Math.ceil(this.avatars.length / this.avatarsPerPage);
        },
        showAssign() {
          return this.selected.length > 0;
        },
        members() {
          const names = [];
          this.team.forEach((member) =>
            names.push(member.firstname + " " + member.lastname)
          );
          return names;
        },
        // filteredKeys() {
        //   return this.keys.filter((key) => key !== `Name`);
        // },
      },
      methods: {
        nextPage() {
          if (this.page + 1 <= this.numberOfPages) this.page += 1;
        },
        formerPage() {
          if (this.page - 1 >= 1) this.page -= 1;
        },
        updateAvatarsPerPage(number) {
          this.avatarsPerPage = number;
        },
        sortAscendingBy(prop) {
          this.avatars.sort((a, b) => (a[prop] < b[prop] ? -1 : 1));
        },
        sortDescendingBy(prop) {
          this.avatars.sort((a, b) => (a[prop] > b[prop] ? -1 : 1));
        },
        assign(e) {
          /**eslint-disable */
          console.log(e(this),this.selected);
        },
       },
     };