{"id":16817327,"url":"https://github.com/phanan/vuequery","last_synced_at":"2025-10-29T09:54:11.824Z","repository":{"id":15415683,"uuid":"78100343","full_name":"phanan/vuequery","owner":"phanan","description":"Traverse Vue's component tree with ease.","archived":false,"fork":false,"pushed_at":"2023-01-06T01:56:05.000Z","size":1242,"stargazers_count":41,"open_issues_count":15,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-14T12:12:14.494Z","etag":null,"topics":["component-tree","selector","traverse","vue"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phanan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-05T09:44:40.000Z","updated_at":"2023-10-08T22:38:21.000Z","dependencies_parsed_at":"2023-01-11T20:23:18.214Z","dependency_job_id":null,"html_url":"https://github.com/phanan/vuequery","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanan%2Fvuequery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanan%2Fvuequery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanan%2Fvuequery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phanan%2Fvuequery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phanan","download_url":"https://codeload.github.com/phanan/vuequery/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902929,"owners_count":20529114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["component-tree","selector","traverse","vue"],"created_at":"2024-10-13T10:46:52.996Z","updated_at":"2025-10-29T09:54:06.771Z","avatar_url":"https://github.com/phanan.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VueQuery [![Build Status](https://travis-ci.org/phanan/vuequery.svg?branch=master)](https://travis-ci.org/phanan/vuequery)\n\n\u003e Traverse [Vue](https://vuejs.org)'s component tree with ease.\n\n\u003e IMPORTANT: Vue's reactivity/event system is extremely powerful and flexible, and should have 99.99% of your use cases covered. In fact, having to traverse the component tree _almost always_ means you're doing Vue wrong. There are certain edge cases, however, when such is required, and this library aims to aid you there.\n\n## Installation \u0026 Usage\n\n\u003e This plugin is only tested for Vue 2.\n\n### Installation\n\n#### Browser\nInclude `vuequery.min.js` as a script:\n\n```html\n\u003cscript src=\"dist/vuequery.min.js\"\u003e\u003c/script\u003e\n```\n\nNow `VueQuery` should be avaiable as a global  function.\n\n#### Node.js\n\nFirst, require VueQuery as a dependency with `npm` or `yarn`:\n\n``` bash\nnpm install vuequery\nyarn add vuequery\n```\n\nThen, import it:\n\n``` js\nimport VueQuery from 'vuequery'\n// You can also alias the import as $ for a jQuery-like experience\nimport $ from 'vuequery'\n```\n\n### Usage\n\nSimilar to jQuery, calling `VueQuery()` on a Vue component returns a VueQuery instance which exposes several API's to let you traverse through Vue's component tree.\n\n``` js\n// assuming we're currently in a Vue component context\n// init a VueQuery instance on the current component\nconst $vm = VueQuery(this)\n\n// get the original Vue component\n$vm.vm\n\n// get the immediate next sibling of the component\n$vm.next()\n\n// chaining is supported\n$vm.prev('foo').children()[0].find('bar')\n```\n\n## API\n\n\u003e As VueQuery is heavily inspired by jQuery, its API signatures are very similar (albeit much less sophisticated) to that of jQuery's traversing module. In fact, the documentation here is more or less copied from [jQuery's](http://api.jquery.com/). Differences, if any, will be explicitly specified.\n\n### `children([selector])`\n\n**Description**: Get the children of the current component, optionally filtered by a `selector`, which can be either\n\n* a string, in which case it will match the components by name. Obviously, for this to work, your components should have the `name` option. This is a good Vue practice anyway.\n* a Vue instance\n* a VueQuery instance, in which case it will match the encapsulated Vue instance\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `closest(selector)`\n\n**Description**: Get the first component that matches the selector by testing the current component itself and traversing up through its ancestors in the component tree.\n\n**Return Values**: `VueQuery|null`\n\n### `find(selector)`\n\n**Description**: Get the descendants of the current component, filtered by a selector.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `has(selector)`\n\n\u003e Note: This API's behavior is different from its jQuery counterpart.\n\n**Description**: Check if the current component has any component that matches the selector in its descendant tree.\n\n**Return Values**: `Boolean`\n\n### `is(selector)`\n\n**Description**: Check if the current component matches the selector.\n\n**Return Values**: `Boolean`\n\n### `next([selector])`\n\n**Description**: Get the immediately following sibling of the current component. If a selector is provided, it retrieves the next sibling only if it matches that selector.\n\n**Return Values**: `VueQuery|null`\n\n### `nextAll([selector])`\n\n**Description**: Get all following siblings of the current component, optionally filtered by a selector.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `nextUntil([selector][, filter])`\n\n**Description**: Get all following siblings of the current component, up to but not including the component matched by the selector passed.\nIf the selector is not matched or is not supplied, all following siblings will be selected; in these cases it selects the same components as the `.nextAll()` method does when no selector is provided.\n\nThe method optionally accepts a `filter` expression for its second argument. If this argument is supplied, the components will be filtered by testing whether they match it.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `parent([selector])`\n\n**Description**: Get the parent of the current component. If the selector is supplied, the parent component will only be returned if it matches it.\n\n**Return Values**: `VueQuery|null`\n\n### `parents([selector])`\n\n**Description**: Get the ancestors of the current component, optionally filtered by a selector.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `parentsUntil([selector][, filter])`\n\n**Description**: Get the ancestors of the current component, up to but not including the component matched by the selector passed.\nIf the selector is not matched or is not supplied, all ancestors will be selected; in these cases it selects the same components as the `.parents()` method does when no selector is provided.\n\nThe method optionally accepts a `filter` expression for its second argument. If this argument is supplied, the components will be filtered by testing whether they match it.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `prev([selector])`\n\n**Description**: Get the immediately preceding sibling of the current component. If a selector is provided, it retrieves the previous sibling only if it matches that selector.\n\n**Return Values**: `VueQuery|null`\n\n### `prevAll([selector])`\n\n**Description**: Get all preceding siblings of the current component, optionally filtered by a selector.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n### `prevUntil([selector][, filter])`\n\n**Description**: Get all preceding siblings of the current component, up to but not including the component matched by the selector passed.\nIf the selector is not matched or is not supplied, all preceding siblings will be selected; in these cases it selects the same components as the `.nextAll()` method does when no selector is provided.\n\nThe method optionally accepts a `filter` expression for its second argument. If this argument is supplied, the components will be filtered by testing whether they match it.\n\n### `siblings([selector])`\n\n**Description**: Get the siblings of the current component, optionally filtered by a selector. The original component is not included among the siblings.\n\n**Return Values**: `Array.\u003cVueQuery\u003e|[]`\n\n## License\n\nMIT \u0026copy; [Phan An](http://phanan.net)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphanan%2Fvuequery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphanan%2Fvuequery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphanan%2Fvuequery/lists"}