Vue.js 3 - No instances of components, really?
P粉790819727
2023-09-04 15:03:23
<p>In Vue 2, you can create a reactive instance without components, like this: </p>
<pre class="brush:php;toolbar:false;">var vue = new Vue({
el: '#root',
data: { /*... */ },
methods: { /* ... */ }
})</pre>
<p>In fact, this is the basic usage pattern introduced at the beginning of the Vue 2 documentation. </p>
<p>I think this is a very elegant way to add responsiveness to existing DOM elements, and the instances created are easy to manipulate programmatically. Is there an equivalent method in Vue 3? </p>
Use CDN