<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script> -->
    <script src="//unpkg.com/vue@2"></script>
    <script src="//unpkg.com/element-ui"></script>
    <script src="//unpkg.com/element-ui/lib/umd/locale/en.js"></script>
    <title>表单</title>
</head>
<body>
    <div id="app">
        <el-input v-model="input" placeholder="请输入内容" ref="input"></el-input>
        <p>message:{{message}}</p>
        <button @click="handleClick">按钮</button>
    </div>
    <script>
        var vm = new Vue({
            el:'#app',
            data(){
                return{
                    message:"23123",
                    input:'12'
                }
            },
            methods:{
                handleClick(){
                    this.$set(this, "input", 6);
                    console.log(this.$refs.input.value)
                }
            }

        })
    </script>
</body>
</html>
this.$set(this, "input", 6);
Logo

前往低代码交流专区

更多推荐