Vuesax v3
Vuesax v3 is a user interface component framework for Vue.js, offering a suite of visually distinctive and customizable components such as buttons, inputs, tables, and popups. The package, `vuesax`, with its last significant release being 3.12.2, was primarily designed for applications built with Vue 2. While the provided release notes indicate a period of active bug fixes and feature additions within the v3 series, the official `vuesax` npm package itself has not seen updates for several years, leading it to be considered effectively abandoned by its original author in favor of a complete rewrite, Vuesax v4. For developers seeking to use Vuesax's design language, this package serves as a legacy option for Vue 2 projects. For Vue 3 compatibility, users should consider community-maintained forks like `vuesax3` or the officially in-development Vuesax v4, which is a separate, in-progress framework.
Common errors
-
TypeError: Cannot read property 'filter' of undefined
cause Often occurs in Vuesax components (e.g., Table component) when data properties expected to be arrays are undefined or null, leading to runtime errors during rendering.fixEnsure that data bound to Vuesax components that expect arrays (like `vs-table`'s `data` prop) is always initialized as an array (e.g., `[]`) to prevent `undefined` access. -
RangeError: Maximum call stack size exceeded
cause Can happen with complex component nesting or improper lifecycle hook usage within Vuesax components, leading to infinite recursion.fixReview component nesting, especially with components like `vs-dropdown` or `vs-select`, and ensure no reactive property updates trigger endless re-renders. Check for circular dependencies or incorrect `beforeDestroy` hook implementations. -
Notification and dialog component gives console error
cause Generic console errors often indicate issues with component state, improper prop usage, or conflicts with global styles/scripts affecting Vuesax's internal logic.fixCheck the specific console error message for more details. Ensure all required props are passed correctly and that there are no conflicting global styles or JavaScript interfering with Vuesax's internal DOM manipulation for notifications and dialogs.
Warnings
- breaking The `vuesax` package (v3) is designed for Vue 2. Attempting to use it directly in a Vue 3 project will lead to incompatibility issues and errors, as Vue 3 introduced significant breaking changes to its API.
- gotcha The original `vuesax` npm package (v3.x.x) is largely unmaintained by its original author, with its last publish date being several years ago for version 3.12.2. Critical bug fixes or new features are unlikely to be released for this version.
- gotcha Vuesax v3 requires an explicit CSS import (`import 'vuesax/dist/vuesax.css'`) for its components to render with the correct styling. Forgetting this import will result in unstyled (plain HTML-looking) components.
- breaking Vuesax v4 (`vuesax-next`) is a complete rewrite with different underlying technologies (e.g., TypeScript, Sass instead of Stylus) and significantly altered APIs compared to Vuesax v3. Migration from v3 to v4 is not a direct upgrade but requires substantial refactoring.
Install
-
npm install vuesax -
yarn add vuesax -
pnpm add vuesax
Imports
- Vuesax (full bundle)
const Vuesax = require('vuesax'); // CommonJS import for ESM-first projects Vue.use(Vuesax);import Vuesax from 'vuesax'; Vue.use(Vuesax);
- Individual components
import { Button, Select } from 'vuesax'; // Incorrect component naming convention import vsButton from 'vuesax/lib/vsButton';import { vsButton, vsSelect } from 'vuesax'; Vue.use(vsButton); Vue.use(vsSelect); - Global CSS
import 'vuesax/dist/style.css'; // Incorrect path // No CSS import at all
import 'vuesax/dist/vuesax.css';
Quickstart
import Vue from 'vue';
import App from './App.vue';
import { vsButton, vsInput } from 'vuesax';
import 'vuesax/dist/vuesax.css'; // Don't forget the styles!
Vue.use(vsButton);
Vue.use(vsInput);
new Vue({
render: h => h(App),
}).$mount('#app');
// App.vue example (inside <template>):
// <template>
// <div id="app">
// <vs-button type="primary">Hello Vuesax</vs-button>
// <vs-input placeholder="Enter text" v-model="myValue"/>
// </div>
// </template>
//
// (inside <script>):
// export default {
// name: 'App',
// data() {
// return {
// myValue: ''
// }
// }
// }