udemy-vue-basic
  • Initial page
  • 始める
    • on directive
    • access data, methods
    • v-bind
    • v-on
  • Untitled
  • Vuex で state を管理する
    • Install
    • Vuex とは
    • はじめよう
    • Core Concepts
      • State
      • getter
      • mutations
      • actions
  • View-router
Powered by GitBook
On this page
  1. 始める

on directive

index.html
<body>

	<div id="app">
		<!-- input が変更されたら changeTitle という method を起動 -->
		<input type="text" @input="changeTitle">
		{{ title }}
	</div>
	<!-- built files will be auto injected -->
</body>
main.js
import Vue from "vue";

new Vue({
  el: "#app",
  data: {
    title: "title"
  },
  methods: {
    changeTitle(event) {
      // this.data.title へのアクセスは簡略化できる
      // title を input から送られて来たものに変更
      this.title = event.target.value;
    }
  }
});

Previous始めるNextaccess data, methods

Last updated 6 years ago