How do I bind events using Nuxt.js programmatically?

< template >

<div @click="loginFn">aaaa</div>

< / template >

< script >

export default {
  data () {
    return {
    }
  },
  methods: {
    loginFn () {
      // alert(1)
      console.log("hehe")
    }
  },
  mounted () {
    console.log("hehe-mounted")
  }
}

< / script >

there are two problems:
1. Does the event not work?
2. Mounted is not executed? It is executed in the created phase, so why doesn"t mounted execute it?

Aug.19,2021

mounted is only executed on the browser side, and events


nuxt.js there are only beforeCreate and created in the life cycle. If you want to obtain data asynchronously, you can use the asyncData method. It is recommended that the landlord first take a detailed look at the nuxt.js official document, ide/" rel=" nofollow noreferrer "> portal .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8dc56-1188.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8dc56-1188.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?