Giter VIP home page Giter VIP logo

vue-tribute's Introduction

vue-tribute

Build Status

A Vue.js wrapper for Zurb's Tribute library for native @mentions.

Install

$ npm install vue-tribute --save

or include the UMD build, hosted by unpkg in a <script> tag. You will also need to include the main Zurb Tribute library:

<script src="js/tribute.js"></script>
<script src="//unpkg.com/vue-tribute"></script>

Usage

import Vue from "vue";
import VueTribute from "vue-tribute";

Vue.use(VueTribute, globalOptions);

The globalOptions parameter is optional.

...and inside your template, bind a dynamic values parameter to some data:

<input type='text'
    v-tribute='tributeUsers'
    :tributeoptions='{ trigger:"#" }' />

The value of v-tribute should be an array of objects that contain a key to search and a value to be inserted. We recommend using a Vue computed property to format your data like so:

computed: {
  tributeUsers: function() {
    return [
      {key: "Phil Heartman", value: "pheartman"},
      {key: "Gordon Ramsey", value: "gramsey"}
    ]
  },
},

The tributeoptions attribute is optional. It is merged with globalOptions and takes precendence.

See the available options here.

Events

Tribute broadcasts two events — a tribute-replaced event, and a tribute-no-match event (see docs here). For your convenience, whenever Tribute triggers these events, vue-tribute also emits these events from the Vue instance the bound element is attached to.

License

MIT © Collin Henderson, Aurélien Nicolas

vue-tribute's People

Contributors

npmcdn-to-unpkg-bot avatar syropian avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.