苍穹
管理员
管理员
  • UID2
  • 粉丝0
  • 关注0
  • 发帖数202
阅读:6571回复:0

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

楼主#
更多 发布于:2018-08-30 22:03
<div id="app">
        <input placeholder="str" v-model='str'>
        <p>pw_ 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>
游客


返回顶部