How can declare template block when using vuejs cdn?

I’m a beginner in vue js. how can declare template block when using vue js cdn?

I assume you’re referring to <template> within a single file component. You can’t use SFC’s with the CDN version of Vue as SFC’s have to be compiled with a build tool.

You can use <script type="text/x-template"> with the CDN version.


<div id="components-demo">

<script id="counter" type="text/x-template">
  <button v-on:click="count++">
  You clicked me {{ count }} times.
const app = Vue.createApp({})

app.component('button-counter', {
  data() {
    return {
      count: 0
  template: `#counter`

1 Like

Thank you for your help! :heart: