Skip to content

egoist/vue-inline

Repository files navigation

vue-inline NPM version NPM downloads Build Status

Inline anything in your Vue component, like string / component / images et al

Install

$ npm install --save vue-inline

Usage

Register the component globally:

import Inline from 'vue-inline'

Vue.use(Inline, {
  data: {
    // inline a string
    foo: 'inlined foo',
    // or an svg image with svg-inline-loader or file-loader
    bar: require('/path/to/bar.svg')
  }
})

Inline it in your component:

<template>
  <!-- render a srring -->
  <inline name="foo"></inline>
  <!-- render an image -->
  <inline name="bar"></inline>
</template>

Or register the inline component locally:

import {makeComponent} from 'vue-inline'

const Inline = makeComponent(data)
// register `Inline` in your component

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT © EGOIST

About

Inline anything in your Vue component

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published