function addToRoom(){
        var dto = {
                id:$("#id").val(),
                fname:$("#name").val(),
                roomId:$("#num").val()
        }
        $.post("/op/addToRoom",dto,function(data){     
            window.location.href="http://localhost:5080/openmeetings/hash?secure="+data.message
        },"json")
}

解决方案 »

  1.   

    <!DOCTYPE html>
    <html> <head>
    <meta charset="utf-8">
    <title></title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    </head> <body>
    <div id="app">
    <input v-model="dto.id">
    <input v-model="dto.name">
    <input v-model="dto.num">
    <button v-on:click="addToRoom">bbbb</button>
    </div>
    </body>
    <script type="text/javascript">
    var app = new Vue({
    el: '#app',
    methods: {
    addToRoom: function() {
    console.log(this.dto.name);
    }
    },
    data: {
    dto: {
    id: "",
    name: "",
    num: ""
    }
    }
    })
    </script></html>
      

  2.   

    谢谢您的回答,但是
    window.location.href="http://localhost:5080/openmeetings/hash?secure="+data.message
    这句代码该如何修改,您没有说明吧。
    应该需要个类似下边的mouted()吧
     mounted(){
                axios
                     //error
                    // .post(http://localhost:5080/openmeetings/hash?secure="+data.message)
                    .then(response => {
                    if(response.data.success === false) alter(response.data.message);
                         this.info = response.data.data;
                    })
                    .catch(function (error) { 
                        console.log(error);
                    });
            }