Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

createElement v-model not import #9691

Closed
xuanjinliang opened this Issue Mar 13, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@xuanjinliang
Copy link

xuanjinliang commented Mar 13, 2019

vue:

2.5.21

Create a component test.vue

<template>
  <div>{{value}}</div>
</template>

<script>
  export default {
    name: 'test',
    props: ['value'],
    data () {
      return {}
    },
    model: {
      prop: 'value',
      event: 'update'
    },
    methods: {},
    watch: {
      value: function value(val, oldVal) {
        console.log(val, oldVal)
      }
    }
  }
</script>

import component test.vue:

<script>
  import Vue from 'vue'
  import test from './test'

  export default {
    name: 'SelectTest',
    props: {
      value: String
    },
    data () {
      return {
        show: false,
        toastTpl: null
      }
    },
    model: {
      prop: 'value', 
      event: 'update'
    },
    // components: { xgoText },
    mounted: function(){
      const that = this
      const popupTpl = Vue.extend({
        render: function (createElement) {
          return createElement( test, {
            directives: [{
              name: 'model',
              rawName: "v-model",
              value: that.show.toString(),
            }]
          }, '')
        }
      });

      this.popupTpl = new popupTpl().$mount().$el
      document.body.appendChild(this.popupTpl);
    },
    methods: {
      showPopup () {
        this.show = !this.show
      }
    }
  }
</script>

The value of the v-model cannot be typed into the component text.vue

@vue-bot

This comment has been minimized.

Copy link
Contributor

vue-bot commented Mar 13, 2019

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!

@vue-bot vue-bot closed this Mar 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.