I
I
Intelix2022-01-16 20:24:01
Vue.js
Intelix, 2022-01-16 20:24:01

Why is there an error when using the example from the vue documentation?

I want to add a copy of the component when the button is clicked.
Found an example in the documentation: https://v3.vuejs.org/guide/migration/global-api.ht...

const Profile = {
  template: '<p>{{firstName}} {{lastName}} aka {{alias}}</p>',
  data() {
    return {
      firstName: 'Walter',
      lastName: 'White',
      alias: 'Heisenberg'
    }
  }
}
Vue.createApp(Profile).mount('#mount-point')


I copy it to the project and when I call the method on the button, I get in the console:

runtime-core.esm-bundler.js?5c40:6800 Uncaught TypeError: Cannot read properties of undefined (reading 'createApp')
    at Proxy.addRequisites (transfers.vue?01d8:167:1)
    at $data.step.Object.onClick._cache.<computed>._cache.<computed> (transfers.vue?01d8:45:1)
    at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:6737:1)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?5c40:6746:1)
    at HTMLDivElement.invoker (runtime-dom.esm-bundler.js?830f:357:1)


What is it and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GrayHorse, 2022-01-17
@GrayHorse

I copy it to the project and when I call the method on the button, I get in the console:

What? What method? Button?
Found an example in the documentation. I copy it to the project

Where can I copy it (incorrectly) if this is already a fully-fledged working application on Vue.js:
<!DOCTYPE html>
<html>
<head>
    <script src="https://unpkg.com/[email protected]"></script>
</head>
<body>
<div id="mount-point"></div>
<script>
    const Profile = {
        template: '<p>{{firstName}} {{lastName}} aka {{alias}}</p>',
        data() {
            return {
                firstName: 'Walter',
                lastName: 'White',
                alias: 'Heisenberg'
            }
        }
    }
    Vue.createApp(Profile).mount('#mount-point')
</script>
</body>
</html>

What is it and why?

This is an exception.
Vue.js was not included.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question