vue mounted

Vue's mounted hook function is a life cycle function called after mounting is completed.

In the mounted function, you can perform DOM operations, obtain data, or subscribe to some data.

In the mounted function, the component has rendered the template into a real DOM and mounted it on the page, so DOM-related operations can be performed in this hook function.

For example:

<template>
  <div>{
      
      {
      
      message}}</div>
</template>

<script>
export default {
  data() {
    return {
      message: 'Hello World'
    }
  },
  moun

Guess you like

Origin blog.csdn.net/weixin_35756373/article/details/129569778