码迷,mamicode.com
首页 > 其他好文 > 详细

VUE页面渲染问题

时间:2018-09-05 09:16:26      阅读:196      评论:0      收藏:0      [点我收藏+]

标签:email   ati   eth   substr   在线   source   script   func   vue   

<!DOCTYPE html>
<html>

<head>
  <script src="./vue.min.js"></script>
  <script src="./vue-resource.min.js"></script>
</head>

<body>
  <div id="app">
    <span v-text=‘message‘></span>
    <br/>
    {{CreationDate}}</div>

  <script>
    var app = new Vue({
      el: "#app",
      data: {
        message: 111,
        CreationDate: 222
      },
      mounted: function () {
        this.init();
        
      },
     
      methods: {
        init: function () {
          var searchStr = location.search;
          searchStr = searchStr.substr(1);
          var searchs = searchStr.split("&");
          var factory = searchs[0].split("=");
          var id = searchs[1].split("=");
          Vue.http.post(http://192.168.224.133:8000/api/NonconformanceReportApi/GetViewData?factory= + factory[
            1], {
            Name: id[1]
          }).then(function (data) {
            if (data.ok) {
             

              this.message = data.data;
              
              this.CreationDate = data.data.CreationDate;
              app.$forceUpdate(); 

            }

          })
        }
      }

    });
    // $(document).ready(function () {
    //   var searchStr = location.search;
    //   searchStr = searchStr.substr(1);
    //   var searchs = searchStr.split("&");
    //   var factory = searchs[0].split("=");
    //   var id = searchs[1].split("=");
    //   $(‘#div1‘).load(‘http://192.168.224.133:8000/api/EmailGroupApi/GetEmailGroups?factory=p2‘);
    //   $("button").click(function () {

    //     $.ajax({
    //       type: ‘post‘,
    //       url: ‘http://192.168.224.133:8000/api/NonconformanceReportApi/GetViewData?factory=‘ + factory[1],
    //       data: {
    //         name: id[1]
    //       },
    //       success: function (data) {
    //         alert(data);
    //         $(‘#div1‘).html(data.FpNcrName)
    //       }
    //     });
    //   });
    // });
  </script>
</body>

</html>

页面数据已经更改 ,但是没有重新渲染,有大神知道什么原因吗,在线等,十分感谢

VUE页面渲染问题

标签:email   ati   eth   substr   在线   source   script   func   vue   

原文地址:https://www.cnblogs.com/lidezhen/p/9589363.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!