1.0.1 ⢠Published 5 years ago
@lewandy/vue-visibility v1.0.1
Vue Visibility š
š Hides or shows elements depending of a criteria.
Vue 3 support š
Install
npm install --save @lewandy/vue-visibility
or
yarn add @lewandy/vue-visibility
š¹ Usage
import { createApp } from "vue";
import App from "./App.vue";
import VueVisibility from "@lewandy/vue-visibility";
const application = createApp(App);
application.use(VueVisibility);
application.mount("#app");
Set identifiers or permissions globally
<script>
export default {
name: "App",
created() {
this.$root.$setVisibilityPermissions([121, 122, 123]);
},
};
</script>
š Examples
Using provider with placeholder slot if not authorized
<template>
<VueVisibilityProvider :identifier="124">
<template v-slot:placeholder>
<h2>You don't have access to see this.</h2>
</template>
<div class="card"><h2>CARD 1</h2></div>
</VueVisibilityProvider>
</template>
Using the directive.
<template>
<div>
<div v-visibility="123" class="card">
<h2>CARD 2</h2>
</div>
</div>
</template>
š¦ VueVisibilityProvider component reference
TODO
- Feature : Can disable elements and make it not clickable.
- Chore : Write basic tests
š¤ Contributing
- Fork this repository.
- Create new branch with feature name.
- Go to example folder and run
npm install
andnpm run serve
. - The plugin sources files is located in /src/VueVisibility.js.
- Commit and set commit message with feature name.
- Push your code to your fork repository.
- Create pull request. š
āļø Support
If you like this project, You can support me with starring ā this repository.
š License
Developed with ā¤ļø and āļø from the dominican republic š“