1.3.8 • Public • Published


Most used vue composables which I would like to make it betters to share between my projects


This project requires NodeJS (version 16 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v

Table of contents

Getting Started


BEFORE YOU INSTALL: please read the prerequisites

Start with cloning this repo on your local machine:

To install and set up the library, run:

$ npm i @bachdx/b-vuse

Or if you prefer using Yarn:

$ yarn add @bachdx/b-vuse

Core Functions


The breadcrumb control that can share across all components without using localStorage or any storage but still reactive

Most of my project using the same structure for breadcrumb as below

Most Used Breadcrumb and Page Title

const breadcrumb = {
  title: "Dummy title",
  items: [
      text: "First Item",
      href: "/first-item",
      active: false, // should be false for all items except last one
      text: "Last Item",
      href: "/last-item",
      active: true,
    // ...another last on your demands

And the component for rendering the breadcrumb

  <div class="row">
    <div class="col-12">
        class="page-title-box d-flex align-items-center justify-content-between"
        <h4 class="mb-0 font-size-18">{{ breadcrumb.title }}</h4>

        <div class="page-title-right">
          <!-- I use vue bootrap here but you can you anything you want -->
          <b-breadcrumb class="m-0">
              v-for="(item, i) in breadcrumb.items"

So if you dont want to use the title, be my guest, just remove the breadcrumb.title

import { useBreadcrumb } from "@bachdx/b-vuse";
Usage Example:
In page (component) where you need to change the breadcrumb
import { useBreadcrumb } from "@bachdx/b-vuse";
const { setBreadcrumb } = useBreadcrumb();

  title: "User List",
  items: [
      text: "User",
      href: "/users",
      text: "List",
      active: true,
In the actual breadcrumb rendering component
import { useBreadcrumb } from "@bachdx/b-vuse";
const { breadcrumb, getBreadcrumb } = useBreadcrumb();

after this you should be able to change the page ( components ) and will have the reactive breadcrumb on every page


You might need to set your router setup to reset the content of breadcrumb before each route changed by doing this


Data and Methods

Type Name Attributes/Params
ref breadcrumb { 'title': String, 'items': [{'text: String, 'href': String, 'active': Boolean }] }
function getBreadcrumb None
function setBreadcrumb { 'title': String, 'items': [{'text: String, 'href': String, 'active': Boolean }] }

useQuery ( use for Rails backend and pagy + ransack supported )

The query object that most of my project use for supporting query data from server and paging support

const queryInput = {
  page: 1,
  perPage: 10,
  q: {}, // this should be ransacker support object
import { useQuery } from "@bachdx/b-vuse";
Usage Example:
In Pinia Store and components ( maybe )
const { queryInput, resetQuery, updateQuery } = useQuery();

or you can change the default params as your needs

const { queryInput, resetQuery, updateQuery } = useQuery({ perPage: 15 });
To update query ( such as page)
updateQuery({ page: page });

Data and Methods

Type Name Attributes/Params
QueryInput queryInput { 'page': 1, 'perPage': 10, 'q': {} }
function resetQuery None
function updateQuery { 'page': 1, 'perPage': 10, 'q': {} }

useGoQuery ( use for Go backend )

The query object that most of my project use for supporting query data from server and paging support

import { useGoQuery } from "@bachdx/b-vuse";
Usage Example:
In Pinia Store and components ( maybe )
const query = reactive({}); // this could be anything related to search key
const { goQueryInput, updatePage } = useGoQuery({ perPage: 10, query: query });
To update page/perPage/Query
updatePage(page, callbackFunction);

Data and Methods

Type Name Attributes/Params
GoQueryInput goQueryInput { pagyInput: {'page': , 'perPage': }, 'query': {} }
function updatePerPage perPage
function updatePage page, callbackFunction
function updateQuery { 'page': 1, 'perPage': 10, 'q': {} }
function resetQuery callbackFunction


  1. Clone it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Add your changes: git add .
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request 😎






Package Sidebar


npm i @bachdx/b-vuse

Weekly Downloads






Unpacked Size

27.8 kB

Total Files


Last publish


  • bachdx