Announcement

Collapse
No announcement yet.

Frage in Bezug auf Funktionsaufruf aus einem Vue-Objekt heraus

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Frage in Bezug auf Funktionsaufruf aus einem Vue-Objekt heraus

    Ich habe mal eine Frage an Vue.js-Entwickler. Also: Wenn ich ein Vue-Objekt habe, kann ich aus diesem heraus eine Funktion innerhalb des JavaScripts aufrufen? Wenn ja, dann wie?

    Code:
    new Vue({
    
        el : '#forum',
    
        data : {
    
        name : document.cookie.split('=')[1]
    
        items: [] // Kann ich hier eine Funktion (zum Ausführen eines AJAX-calls) aurufen, wenn ja, dann wie?
    }
    });
    Zuletzt editiert von gfoidl; 19.08.2020, 09:54.

  • #2
    Hallo,

    ja geht, am besten im "mounted"-Hook. Für ein Beispiel siehe Using Axios to Consume APIs.

    mfG Gü
    "Any fool can write code that a computer can understand. Good programmers write code that humans can understand". - Martin Fowler

    Comment


    • #3
      Cool, danke.

      Comment

      Working...
      X