vue-js获取input输入值---vue学习笔记

	<div id="app">
		<input placeholder="str" v-model='str'>
		<p>{{ getStr }} p>
		<button type="button" v-on:click='btnClick' >获取button>
	div>
<script type="text/javascript">
var vm=	new Vue({
		el: '#app',
		data: {
			str: '初始值',
			getStr: null,
		},
		created: function() {
			// the created hook is called after the instance is created
		},
		computed: {
		},
		methods: {
			btnClick: function() {
				this.getStr = this.str.toUpperCase();
			},
		}
	})
</script>

vue-js获取input输入值---vue学习笔记_第1张图片

你可能感兴趣的:(vue-js获取input输入值---vue学习笔记)