首页 > 解决方案 > 加载页面后,从 VueJS 中的“方法”调用“创建”函数

问题描述

我是Vue JS 新手 我的 VueJS 应用程序结构是这样的

<template>
  <div>
    //HTML CODE
  </div>
</template>

<script>
export default {
  data() {
    return {

  },
  methods: {
   functionABC(){
   // CAN I CALL created() in this function ?
   }
  },
  created() {
    //SOME FUNCTIONS
  }
};
</script>

<style scoped>

</style>

我知道我可以在 created() 中为首页加载时发生的所有操作创建一个函数,然后在每次需要时调用该函数,这也将达到目的,但我实际上想知道调用 created() 的正确方法) 功能,即使在页面加载后

标签: javascriptvue.js

解决方案


I think that you can't. If there is a way to do it I think that is not recommended. You should do a function and call it from created or from another function to not duplicate code


推荐阅读