2017-02-10 4 views
0

必須jを使用しています。任意の環境(現時点では現地からのスクリーンショット)への配備後、リフレッシュの問題が発生しています。ページが正しく読み込まれていません。私は火かき棒でネットワークタブをチェックしました。その表示(画像の下)。ファイルが200 OK(BF Cache)のステータスを取得すると、ページが正しく読み込まれません。ブラウザキャッシュからのファイルアクセス中にJS Refressの問題が発生する

enter image description here

エラー:

enter image description here

Ctrl + F5キー

を与えた後、すべてのページが正しく来ています。

​​

私はその作業asexpected

私requirejsの設定ファイルのみCTRL + F5の多くを与える必要があるいくつかの時間:

require.config({ 
    baseUrl: "../../../../../../../Scripts", 
    //waitSecond: 0, 
    //urlArgs : "q="+new Date().getTime(), 
    enforcedefine: true, 
    paths: { 
     //RequireJS Plugins. 
     'text': 'lib/requirejs/text', 
     'domReady': 'lib/requirejs/domReady', 
     'app': 'app', 
     'noext': 'lib/requirejs/noext', 

     // Shared Libraries. 
     'jquery': 'lib/Kendo/jquery.min', 
     'jqueryMigrate': 'lib/jquery-migrate-1.2.1.min', 
     'jszip': 'lib/jszip', 
     'kendo': 'lib/Kendo/kendo.all.min', 
     'materialize': 'lib/materialize/materialize', 
     'jqueryValidate': 'jquery.validate.min', 
     'jsignature': 'lib/jSignature/jSignature.min', 
     'jqueryMaskedinput': 'lib/jquery/jquery.maskedinput.min', 
     'jqueryMd5': 'lib/jquery/jquery.md5', 
     'truckNotifier': 'Controls/serviceTruck.Notifier' 
    }, 
    shim: { 
     'app': { 
      deps: ['kendo'] 
     }, 
     'kendo': { 
      deps: ['jquery', 'jszip'], 
     }, 
     'jqueryExtensions': { 
      deps: ['jquery'], 
     }, 
     'materialize': { 
      deps: ['jquery', 'kendo'], 
     }, 
     'krossRespJs': { 
      deps: ['jquery'], 
     }, 
     'jqueryMaskedinput': { 
      deps: ['jquery'], 
     }, 
     'truckUploadSelector': { 
      deps: ['jquery'], 
     }, 
     'underscore': { 
      exports: '_' 
     } 
    } 
}); 

app.jsファイル:

(function (factory) { 
    if (typeof define === 'function' && define.amd) { 
     // AMD. Register as an anonymous module. 
     define([ 
      'domReady!', 
      'text', 
      'noext', 
      'jquery', 
      'kendo', 
      'jszip', 
      'truckNotifier' 
     ], factory); 
    } else { 
     // Browser globals 
     factory(jQuery); 
    } 
}(function (domReady,text,noext,$,kendo,jszip,truckNotifier) { 
    'use strict'; 
    var app = kendo.observable({ 
     // ---- PUBLIC FIELDS ---- 
     DATE_FORMAT: 'MM/dd/yyyy', 
     DATE_MASK: '99/99/9999', 
     DATE_TIME_FORMAT: 'MM/dd/yyyy HH:mm', 
     DATE_TIME_MASK: '99/99/9999 99:99', 
     PHONE_MASK: '(999) 999-9999', 
     TIME_FORMAT: 'HH:mm', 
     TIME_MASK: '99:99', 
     $notifier: $('#notify_container'), 
     router: new kendo.Router(), 
     isInitialized: false, 
     /** This call sets up background components of the current page. */ 

     initialize: function() { 
      var self = this; 
      // Initialize this first so it can show loading while the rest 
      // of this module loads. 

      if (!self.isInitialized) { 
       $('.link-external').attr('target', '_blank'); 

       $('#notify_container').serviceTruckNotifier(); 
       self.isInitialized = true; 
      } 

      window.JSZip = jszip; 

     }, 
     showPleaseWait: function (show) { 
     }, 
     /* Pops up a notification at the top of the page. */ 
     notify: function (type, message) { 
      var types = { 
       'push': 'notifyPush', 
       'info': 'notifyInfo', 
       'success': 'notifySuccess', 
       'error': 'notifyError', 
       'warn': 'notifyWarn', 
       'expired': 'notifyExpired' 
      }; 
      this.$notifier.serviceTruckNotifier(types[type], message); 
     } 
    }); 
    app.initialize(); 
    return app; 
})); 
ビューページで使用される

スクリプト:

<script> 
    require([ 
     'domReady!', 
     'text', 
     'noext', 
     'app', 
     'jquery', 
     'jqueryValidate', 
     'kendo', 
     'truckNotifier' 
    ], 
    function (
     domReady, 
     text, 
     noext, 
     app, 
     $, 
     jqueryValidate, 
     kendo, 
     truckNotifier 
     ) { 
     var notifier = $('#notify_container'), 
      message = '@(ViewBag.Message)'; 
     $("#primaryTextButton").kendoButton(); 
     $('.all-content').removeClass('dn'); 
     $('.mcenter').addClass('dn'); 
     if (message != "") { 
      notifier.serviceTruckNotifier("notifyExpired", "@C.LINK_HAS_BEEN_EXPIRED"); 
     } 
    }); 
</script> 

HTMLファイル:

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8" /> 
    <title>@ViewBag.Title</title> 
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
    <meta name="viewport" content="width=device-width" /> 
    @Styles.Render("~/Content/Styles/all/css") 
    <script src="~/Scripts/lib/requirejs/require.js"></script> 
    <script src="~/Scripts/config.js"></script> 

</head> 
<body id="@RenderSection("BodyId", false)"> 
    @{ 
     System.Reflection.Assembly web = typeof(ServiceTruck.Web.Models.ExternalLogin).Assembly; 

     System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly(); 
     System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(web.Location); 
     string version = fvi.FileVersion; 

     System.Reflection.AssemblyName webName = web.GetName(); 
     string myVersion = version.ToString(); 
     ViewBag.Version = myVersion; 
    } 

    @RenderSection("featured", required: false) 
    <section class="container-fluid"> 
     @RenderBody() 
    </section> 
    <!-- Service Truck Layout Footer Start --> 
    <footer class="copy-right"> 
     <div class="col-md-6 text-left"> 
      <p>All rights reserved.</p> 
      <p>Copyright © 2016 <a href="#">Name</a>.</p> 
     </div> 
     <div class="col-md-6 text-right"> 
      <p>Build @myVersion</p> 
      <p>Recommended Browsers: Internet Explorer 11, Firefox 48, Chrome 52</p> 
     </div> 
    </footer> 
    <!-- Service Truck Layout Footer End --> 
    @RenderSection("scripts", required: false) 

</body> 
</html> 
+0

間欠エラーは、ほとんどの場合、RequireJSを誤って構成するか、起動シーケンスが正しくないことが原因です。あなたの質問には、何が間違っているのかを推測する以上の情報を含んでいません。あなたの質問を[mcve]に編集してください。特に、RequireJSの設定と、コード読み込みの仕方(HTMLの場合と同じ順序で 'script'タグ)を表示する必要があります。 – Louis

+0

私はあなたがそれをチェックしてください質問を更新しました。 –

+0

1つのコードスニペットに「ファイル」という見出しがあります。これはどんなファイルですか?あなたはたくさんのファイルを読み込んでいます。また、私の以前のコメントは、「コードの読み込み**(あなたのHTMLと同じ順序で 'script'タグ)**をどのように開始するかを示す必要があります**」と述べています。 (強調が追加されました)あなたはあなたのHTMLと同じ順序で 'script'タグを表示していません。大事です。アプリケーションの起動の一環です。 – Louis

答えて

0
間違いなくあなたの設定に問題がある

ことの一つは、appためshimです:

'app': { 
     deps: ['kendo'] 
    }, 

appモジュールはAMDモジュールです:defineを呼び出します。したがって、shimを使用することはできません。恩恵を受けることができないモジュールにshimを設定すると、未定義の動作につながる可能性があります。

私はこれを使って実験を実行し、あるバージョンのRequireJSから次のバージョンへの一貫性のない結果を得ました。ポイントは、AMDモジュールのshimにセマンティクスが定義されていないことです。

+0

「app」の依存関係を削除しました。まだ同じ問題に直面している –

関連する問題