All Projects → hacke2 → vue-append

hacke2 / vue-append

Licence: MIT license
vue-append, like v-html directive, but it can call javascript function.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue-append

Vue Esc
🏃 Vue.js directive to add a document event listener on escape keyup.
Stars: ✭ 33 (-10.81%)
Mutual labels:  vue-directive
Vue Prlx
🔮 Vue.js parallax directive you were looking for (can animate translate & background-position)
Stars: ✭ 140 (+278.38%)
Mutual labels:  vue-directive
Intro To Vue
Workshop Materials for my Introduction to Vue.js Workshop
Stars: ✭ 2,668 (+7110.81%)
Mutual labels:  vue-directive
V Img Fallback
Vue Image Fallback
Stars: ✭ 43 (+16.22%)
Mutual labels:  vue-directive
V Directives
vue自定义指令集合
Stars: ✭ 109 (+194.59%)
Mutual labels:  vue-directive
Vue Codemirror
⌨️ @codemirror component for @vuejs
Stars: ✭ 2,115 (+5616.22%)
Mutual labels:  vue-directive
V Click Outside
🔲 Vue directive to react on clicks outside an element without stopping the event propagation
Stars: ✭ 755 (+1940.54%)
Mutual labels:  vue-directive
shadow
Shadow dom support for Vue
Stars: ✭ 46 (+24.32%)
Mutual labels:  vue-directive
Vue Scroll Reveal
A Vue directive to wrap @jlmake's excellent ScrollReveal library.
Stars: ✭ 138 (+272.97%)
Mutual labels:  vue-directive
Vue Occupy
A Vue directive for occupying content places before the data has been loaded.
Stars: ✭ 217 (+486.49%)
Mutual labels:  vue-directive
V Animate Css
The easiest to implement Vue directive for Animate.css
Stars: ✭ 59 (+59.46%)
Mutual labels:  vue-directive
Vue Inputmask
Vue.js directive to add inputmask library to your inputs (vanilla javascript).
Stars: ✭ 110 (+197.3%)
Mutual labels:  vue-directive
Vue Sticky
Stars: ✭ 161 (+335.14%)
Mutual labels:  vue-directive
Navscroll Js
Lightweight package for highlighting menu items as you scroll the page, also scrolling to target section when item clicked. Use as a vue component/directive or in vanilla js.
Stars: ✭ 41 (+10.81%)
Mutual labels:  vue-directive
vue-on-click-outside
vue mixin/directive that does something when you click outside a container
Stars: ✭ 32 (-13.51%)
Mutual labels:  vue-directive
Vue Quill Editor
🍡@quilljs editor component for @vuejs
Stars: ✭ 6,874 (+18478.38%)
Mutual labels:  vue-directive
Vue Awesome Swiper
🏆 Swiper component for @vuejs
Stars: ✭ 12,072 (+32527.03%)
Mutual labels:  vue-directive
vue-drag-zone
Drag Zone component for @vuejs
Stars: ✭ 127 (+243.24%)
Mutual labels:  vue-directive
vue-img-orientation-changer
A vue plugin that can help you display image in correct orientation.
Stars: ✭ 38 (+2.7%)
Mutual labels:  vue-directive
V Blur
⬜️ Vue directive to blur an element dynamically
Stars: ✭ 173 (+367.57%)
Mutual labels:  vue-directive

vue-append

vue-append, like v-html directive, but it can call javascript function

Install

npm install vue-append --save
# or
yarn add vue-append

Es6 module

  • Available through npm as vue-append.
  import VueAppend from 'vue-append'
  Vue.use(VueAppend)

CommonJS

  var VueAppend = require('vue-append')
  Vue.use(VueAppend)

Direct include

  • You can also directly include it with a <script> tag. It will automatically install itself, and will add a global VueAppend.

Event

appended

  • if html append , script downloaded and no throw error, it will fire appended event.

appenderr

  • if throw error when html appended, it will fire appenderr event.

Usage

Using the v-append directive

template:

<div id="app">
    <div v-append="html" @appended="appended"></div>
</div>
<div id="app">
    <div v-append.sync="html" @appended="appended"></div>
</div>

js:

import Vue from 'vue/dist/vue.esm'
import VueAppend from 'vue-append'

// use the plugin
Vue.use(VueAppend);

const html = `
<div id="test">1</div>
<script
  src="https://code.jquery.com/jquery-3.4.1.min.js"
  integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
  crossorigin="anonymous"></script>
<script>
var i = 1;
setInterval(function() {
    document.getElementById("test").innerHTML = ++i;
}, 1000);
</script>

`;

new Vue({
  el: '#app',
  data: {
    html: html
  },
  methods: {
    appended() {
      console.log('appended!');
      // could use jQuery 😊
      alert(window.jQuery);
    }
  }
});

See /example for a timer demo. To build it, run npm install && npm run build.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].