当前位置:网站首页>Asp doNet Mvc4绑定js脚本用法
Asp doNet Mvc4绑定js脚本用法
2022-08-11 05:24:00 【Three Big Stones】
1、绑定配置类中处理需要绑定的脚本文件
public class BundleConfig
{
// 有关 Bundling 的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/Content/scripts/utils/js").Include(
"~/Content/scripts/utils/test1.js",
"~/Content/scripts/utils/test2.js"));
}
}
2、在razor视图中引入js脚本文件
@System.Web.Optimization.Scripts.Render("~/Content/scripts/utils/js")
表示同时引入test1.js和test2.js,js脚本改变,前端自动生成一个不同的id参数,这样前端会读取最新的脚本文件,而不是从浏览器缓存中读取,解决了服务器上脚本变化,前端需要手动清除缓存才能刷新的问题。
边栏推荐
- Maykle Studio - HarmonyOS Application Development Third Training
- 我心仪的数据集—目标检测为主
- LAGRANGIAN FLUID SIMULATION WITH CONTINUOUS CONVOLUTIONS
- CMT2380F32模块开发7-reset例程
- 智慧工地 安全帽识别系统
- The working principle and industry application of AI intelligent image recognition
- AIDL 简介以及使用
- SWOT分析法
- TAMNet: A loss-balanced multi-task model for simultaneous detection and segmentation
- Mei cole studios - deep learning second BP neural network
猜你喜欢
梅科尔工作室-深度学习第二讲 BP神经网络
Reconstruction and Synthesis of Lidar Point Clouds of Spray
LAGRANGIAN FLUID SIMULATION WITH CONTINUOUS CONVOLUTIONS
微信小程序canvas画图,保存页面为海报
SWOT分析法
安全帽识别系统-解决监管难题
关于mmdetection框架实用小工具说明
Use regex to verify whether the file name is legal
The working principle and industry application of AI intelligent image recognition
【OAuth2】授权机制
随机推荐
防盗链——防止其他页面通过url直接访问本站资源
梅科尔工作室-第四次PR培训笔记(字幕和标题动画,关键帧动画和声音处理)
Mysql导入UTF8编码数据库命令总结
数据库的基本语法(其一)
Node-1.高性能服务器
推出 Space Marketplace 测试版 | 新发布
LiDAR Snowfall Simulation for Robust 3D Object Detection
通用的 kernel和 userspace Makefile
微信小程序部分功能细节
Hard hat identification
物联网IOT 固件升级
Joint 3D Instance Segmentation and Object Detection for Autonomous Driving
Waymo数据集使用介绍(waymo-open-dataset)
OpenPCDet installs the latest version: spconv in one step
梅科尔工作室-华为云ModelArts第一次培训
解决jupyter中import torch出错问题
弱监督语义分割CLIMS(CVPR2022)
微信小程序canvas画图,保存页面为海报
自定义形状seekbar学习--方向盘view
CMT2380F32模块开发5-CLK例程