Javascript/vue/基本
提供: 初心者エンジニアの簡易メモ
2018年4月13日 (金) 18:26時点におけるAdmin (トーク | 投稿記録)による版 (ページの作成:「 ==vue.js記述== 以下記述でid内のdivにだけ適用できる。 <pre> new Vue({ el: '#column1', data: { text1: 'ぴよぴよ', text2: 'ぴよぴよ'...」)
vue.js記述
以下記述でid内のdivにだけ適用できる。
new Vue({
el: '#column1',
data: {
text1: 'ぴよぴよ',
text2: 'ぴよぴよ'
}
});
テキスト出力
{{text1}}
inputボックス出力
<input v-model="text1" />
入力したものが他の{{text1}}などに適用される
inputボックスに数字を出力
<input v-model="num1" type="number" />
updownボタン付きで入力欄が表示される
ボタン処理
<button v-on:click="click1">登録</button>
{{text1}} → {{text2}}
new Vue({
el: '#column1',
data: {
text1: 'ぴよぴよ1',
text2: 'ぴよぴよ2'
},
methods: {
output: function (){
this.text2 = this.text1;
}
}
});
