Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hairyf/vue3-local-scope

Generate fully typed local scope in the template of Vue3
https://github.com/hairyf/vue3-local-scope

Last synced: about 1 month ago
JSON representation

Generate fully typed local scope in the template of Vue3

Awesome Lists containing this project

README

        

# vue3-local-scope

[![NPM version](https://img.shields.io/npm/v/vue3-local-scope?color=a1b858&label=)](https://www.npmjs.com/package/vue3-local-scope)

Based on [Vue 3.3](https://blog.vuejs.org/posts/vue-3-3), Similar to [vue-local-scope](https://github.com/posva/vue-local-scope), for use in Vue 3 Local Scope with full type hints.

## Usage

Vue3 Local Scope exports two things:

- **LocalScope**: a functional component that passes any props to the scoped slot with full type hints.
- **createLocalScope**: same as [vue-local-scope#createLocalScope](https://github.com/posva/vue-local-scope/tree/master#createlocalscope).

### LocalScope

LocalScope is the same as [vue-local-scope#LocalScope](https://github.com/posva/vue-local-scope/blob/master/README.md#localscope). It renders anything passed as the scoped slot. It allows you to avoid duplicating your code and provides full types.

```html





{{ `rotate = ${it.rotate}` }}

import { LocalScope } from 'vue3-local-scope'
import { ref } from 'vue'
const textures = ref([])
// ....

```

As it is a functional component, you can return any number of elements, and LocalScope will be invoked whenever certain content in the same template changes.

## createLocalScope

Refer to [vue-local-scope#createLocalScope](https://github.com/posva/vue-local-scope/tree/master#createlocalscope).

## License

[MIT](./LICENSE) License © 2022 [hairyf](https://github.com/hairyf)