How to use the vue.compile function in vue

To help you get started, we’ve selected a few vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wxsms / uiv / test / specs / scroll.spec.js View on Github external
it('should be able to bind scroll function', async () => {
    const res = Vue.compile('<div></div>')
    const vm = new Vue({
      data () {
        return {
          msg: 'hello'
        }
      },
      directives: {scroll},
      methods: {
        onScroll () {
          // TODO
        }
      },
      render: res.render,
      staticRenderFns: res.staticRenderFns
    })
    vm.$mount()
github wxsms / uiv / test / specs / Tooltip.spec.js View on Github external
it('directive with invalid modifiers should be ok', async () =&gt; {
    // invalid modifier should be ok
    const res = Vue.compile('')
    const vm = new Vue({
      data () {
        return {
          msg: 'title'
        }
      },
      render: res.render,
      staticRenderFns: res.staticRenderFns
    }).$mount()
    await vm.$nextTick()
    const trigger = vm.$el
    utils.triggerEvent(trigger, 'click')
    await utils.sleep(300)
    const tooltip = document.querySelector('.tooltip')
    expect(tooltip).to.exist
    expect(tooltip.querySelector('.tooltip-inner').innerText).to.equal('title')
github wxsms / uiv / test / specs / Tooltip.spec.js View on Github external
it('should be able to change enable in runtime', async () =&gt; {
    const res = Vue.compile('123')
    const vm = new Vue({
      data () {
        return {
          msg: 'text',
          enable: true
        }
      },
      components: {Tooltip},
      render: res.render,
      staticRenderFns: res.staticRenderFns
    }).$mount()
    const $el = $(vm.$el).appendTo('body')
    expect(document.querySelectorAll('.tooltip').length).to.equal(0)
    await vm.$nextTick()
    const trigger = vm.$el.querySelector('button')
    utils.triggerEvent(trigger, 'click')
github wxsms / uiv / test / specs / Tooltip.spec.js View on Github external
it('should be able to render with no content', async () =&gt; {
    const res = Vue.compile('')
    const vm = new Vue({
      data () {
        return {
          msg: 'hello'
        }
      },
      components: {Tooltip},
      render: res.render,
      staticRenderFns: res.staticRenderFns
    }).$mount()
    const $el = $(vm.$el)
    $el.appendTo('body')
    await vm.$nextTick()
    $el.remove()
    vm.$destroy()
  })
github wxsms / uiv / test / specs / Tabs.spec.js View on Github external
it('should be able to add String `customNavClass`', () =&gt; {
    const res = Vue.compile('123')
    const vm = new Vue({
      components: {Tab, Tabs},
      render: res.render,
      staticRenderFns: res.staticRenderFns
    })
    vm.$mount()
    expect(vm.$el.querySelector('.nav.nav-tabs').className).to.contain('custom-nav-class')
    $(vm.$el).remove()
    vm.$destroy()
  })
github wxsms / uiv / test / specs / Dropdown.spec.js View on Github external
it('should not close dropdown on self click if not-close-elements contains component ref and with append-to-body', async () =&gt; {
    const res = Vue.compile('<button type="button" class="btn btn-default dropdown-toggle"><span>Dropdown 1</span><span class="caret"></span></button><template slot="dropdown"><li><a href="#">Action</a></li></template>')
    const vm = new Vue({
      data () {
        return {
          show: true,
          eles: []
        }
      },
      mounted () {
        this.eles.push(this.$el)
      },
      render: res.render,
      staticRenderFns: res.staticRenderFns
    }).$mount()
    await vm.$nextTick()
    const dropdown = vm.$el
    expect(dropdown.tagName.toLowerCase()).to.equal('div')
github wxsms / uiv / test / specs / Breadcrumbs.spec.js View on Github external
it('should render nothing if no children and items', async () =&gt; {
    const res = Vue.compile('')
    const _vm = new Vue({
      render: res.render,
      staticRenderFns: res.staticRenderFns
    }).$mount()
    const $breadcrumb = $(_vm.$el)
    await _vm.$nextTick()
    expect($breadcrumb.children().length).to.equal(0)
    _vm.$destroy()
  })
})
github wxsms / uiv / test / specs / Carousel.spec.js View on Github external
it('should be able to work with v-model', async () =&gt; {
    const res = Vue.compile('12')
    const _vm = new Vue({
      data () {
        return {
          index: 1
        }
      },
      components: {Carousel, Slide},
      render: res.render,
      staticRenderFns: res.staticRenderFns
    }).$mount()
    $el = $(_vm.$el)
    await _vm.$nextTick()
    expect($el.find('.carousel-inner .item.active').length).to.equal(1)
    expect($el.find('.carousel-inner .item').get(1).className).to.contain('active')
    utils.triggerEvent($el.find('.carousel-control.right').get(0), 'click')
    await utils.sleep(700)
github bagisto / bagisto / packages / Webkul / Velocity / src / Resources / assets / js / app.js View on Github external
getDynamicHTML: function (input) {
                var _staticRenderFns;
                const { render, staticRenderFns } = Vue.compile(input);

                if (this.$options.staticRenderFns.length > 0) {
                    _staticRenderFns = this.$options.staticRenderFns;
                } else {
                    _staticRenderFns = this.$options.staticRenderFns = staticRenderFns;
                }

                try {
                    var output = render.call(this, this.$createElement);
                } catch (exception) {
                    console.log(this.__('error.something_went_wrong'));
                }

                this.$options.staticRenderFns = _staticRenderFns;

                return output;
github bolt / core / assets / js / app / editor / Components / Collection.vue View on Github external
compile(element) {
      return Vue.compile(element);
    },
    setAllButtonsStates(collectionContainer) {