0.0.8 • Published 3 years ago

vue-lite-crud v0.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Vue crud component

Vue crud component

Project setup

npm i vue-lite-crud

Usage

Props

namedescriptiontyperequired
mainMain account infoObject(id,title,img)true
subSub accounts infoArrayObject(id,title,img)...true
show-subSub accounts show/hideBooleanfalse

Emit

namedescriptionreturn type
deleteMainDelete main accountNumber(main id)
deleteSubSub accounts infoObject(Number(main id),Number(sub id))
refreshYou can use it if you want to manually pull up-to-date data.Only return emit
addIf you want to add to the list, it adds a "+" button and emits when clicked.Only return emit

Usage with Nuxt

<template>
  <client-only>
    <Crud
      :main="main"
      :sub="sub"
      @deleteSub="deleteSub"
      @deleteMain="deleteMain"
      @refresh="refresh"
      @add="add"
    />
  </client-only>
</template>

<script>
export default {
  components: {
    Crud: () => import("vue-lite-crud"),
  },
  data() {
    return {
      main: {
        id: 1,
        title: "Main Account",
        img: "https://thispersondoesnotexist.com/image",
      },
      sub: [
        {
          id: 1,
          img: "https://thispersondoesnotexist.com/image",
          title: "test 1",
        },
        {
          id: 2,
          img: "https://thispersondoesnotexist.com/image",
          title: "test 2",
        },
      ],
    };
  },
  methods: {
    deleteSub(Ids) {
      console.log(Ids);
      //{main: 1, sub: 1} ->id
    },
    deleteMain(id) {
      console.log("deleteMain:", id);
    },
    refresh(id) {
      console.log("refresh id:", id);
    },
    add(id) {
      console.log("add id:", id);
    },
  },
};
</script>

"Kozmonos Patreon"

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago