I
I
Igor2021-01-06 18:32:11
Vue.js
Igor, 2021-01-06 18:32:11

How to render a vue component file into a selector?

How to render a vue component file into a selector?

I have a component VTaskDialog

5ff5d6be69d57147007359.png

In order not to clog the template with inserts, like <v-task-dialog />
I want to create a primitive plugin in order to render a dialog.

Here is an example how I want to use it

export default Vue.extend({

  methods: {
    onTaskAddClick () {
      this.$dialog.show(VTaskDialog)
    }
  }
})
</script>


I want to buy this skill.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2021-01-06
@DKWLB

Offhand, but I'm not a guru in this.
in app.js

let dialog = {}
dialog['show'] = (command) => {
    return command;
};
Vue.prototype.$dialog = dialog// регистрируете

in method
onTaskAddClick () {
      console.log(this.$dialog.show('i am show command'))
    }

ps this modal window is so implemented, but I ate with it and eventually did my own

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question