zoukankan      html  css  js  c++  java
  • 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>

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

  • 相关阅读:
    Python基础综合练习
    熟悉常用的Linux操作
    大数据概述
    C语言简易文法(无左递归)
    自动机
    C语言简易文法
    词法分析实验报告
    词法分析
    综合练习:词频统计
    组合数据类型综合练习
  • 原文地址:https://www.cnblogs.com/lidezhen/p/9589363.html
Copyright © 2011-2022 走看看