Answers for "vuejs instance"

45

vue lifecycle hooks

<script>
  export default {
    beforeCreate() {
      console.log("beforeCreate")
    },
    created() {
      console.log("created")
    },
    beforeMount() {
      console.log("beforeMount")
    },
    mounted() {
      console.log("mounted")
    },
    beforeUpdate() {
      console.log("beforeUpdate")
    },
    updated() {
      console.log("updated")
    },
    beforeDestroy() {
      console.log("beforeDestroy")
    },
    destroyed() {
      console.log("destroyed")
    }
  }
</script>
Posted by: Guest on June-07-2020
0

vue instance

<script>
     new Vue({
     	el: "#appRoot",
        data() {
        return {
         name: "john doe"
        }
       }
     })
  </script>
Posted by: Guest on July-07-2021
0

vue instance

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
  <title>JS Bin</title>
</head>
<body>
  <div id="appRoot">
    <h1>{{ name }} </h1>
  </div>
</body>
   <script>
     new Vue({
        data() {
        return {
         name: "john doe"
        }
       }
     })
     .$mount("#appRoot")
  </script>
</html>
Posted by: Guest on July-07-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language