https://github.com/seregpie/vuetexttemplate
Replaces the tokens inside a text template with the scoped slots.
https://github.com/seregpie/vuetexttemplate
component scope slot template text token vue
Last synced: about 1 month ago
JSON representation
Replaces the tokens inside a text template with the scoped slots.
- Host: GitHub
- URL: https://github.com/seregpie/vuetexttemplate
- Owner: SeregPie
- License: mit
- Created: 2018-06-12T19:55:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-07T12:07:51.000Z (over 6 years ago)
- Last Synced: 2025-02-07T14:24:04.733Z (8 months ago)
- Topics: component, scope, slot, template, text, token, vue
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VueTextTemplate
Replaces the tokens inside a text template with the scoped slots.
## dependencies
- [renderTemplate](https://github.com/SeregPie/renderTemplate)
## setup
### npm
```shell
npm i vuetexttemplate
```### ES module
Register the component globally.
```javascript
import Vue from 'vue';
import VueTextTemplate from 'vuetexttemplate';Vue.component(VueTextTemplate.name, VueTextTemplate);
```*or*
Register the component in the scope of another component.
```javascript
import VueTextTemplate from 'vuetexttemplate';export default {
components: {
[VueTextTemplate.name]: VueTextTemplate,
},
// ...
};
```### browser
```html
```
If Vue is detected, the component will be registered automatically.
## usage
```html
```
```javascript
// ...
data: {
text: 'Choose between {{ 0 }}, {{ 1 }} and {{ 2 }}.',
items: [
{icon: 'train', color: 'red'},
{icon: 'tram', color: 'green'},
{icon: 'subway', color: 'blue'},
],
},
```## properties
| property | type | default |
| ---: | :--- | :--- |
| `regex` | | * |
| `tag` | `String` | `'div'` |
| `template` | `String` | `''` |---
```javascript
import renderTemplate from '@seregpie/render-template';let regex = function() {
return renderTemplate.regex;
};
```