Files
zszq-trs/YLErpWeb/wwwroot/Statics/libs/vue/vue.custom.js
T
hjhan 14ed09d628 build: 接入 BuildBundlerMinifier 自动重建 bundle 产物并剥离源文件 BOM
- 根因:页面(_MainLayout 等)加载的是 bundle.js 等由 bundleconfig.json 打包的生成产物,
  但 csproj 未接入 BundlerMinifier,dotnet build 不会重生它们,Jenkins 只是把 git 里
  陈旧的 bundle.js 原样发布 -> 改了 fastVue.base.js 后回车不生效(部署的 bundle 仍是无
  enter 的旧版)。且源文件带 UTF-8 BOM,拼接后每个 BOM 落入文件中间成为 ZWNBSP,提交
  diff 充满不可见字符(历史上曾多次在产物上手工清 BOM 打补丁)。
- 修复:
  1. YLErpWeb.csproj 新增 BuildBundlerMinifier(3.2.449);其 BundleMinify 目标在
     BeforeCompile 自动按 bundleconfig.json 重建全部 bundle,Jenkins 构建即自动产出正确版本,
     不再需要手工重建并提交 bundle.js。
  2. .gitignore 忽略 8 个生成产物(jquery.js/bundle.js/vue.js/bundle.css/bundleV2.css/
     bundleV2.js/bundle.min.css/bundleV2.min.css) 并 git rm --cached 取消跟踪;这些产物
     永不再入版本库、永不陈旧。
  3. 剥离 15 个喂给 bundle 的源文件(及 css)开头的 UTF-8 BOM,使重建产物不再含 ZWNBSP。
- 验证:本地 dotnet build -t:BundleMinify 重建后 8 个 bundle 全部 BOM=0,bundle.js 含完整
  enter 链路(_enterFired/isEnter/$emit('enter'));删除 bundle.min.css 后构建可自动重建。
2026-07-29 15:42:35 +08:00

93 lines
2.7 KiB
JavaScript

Vue.directive('disabled', {
update: function (newValue) {
if (newValue) {
$(this.el).prop("disabled", true);
} else {
$(this.el).prop("disabled", false);
}
}
});
Vue.directive('enabled', {
update: function (newValue) {
if (newValue) {
$(this.el).prop("disabled", false);
} else {
$(this.el).prop("disabled", true);
}
}
});
Vue.directive('spage-close', function (val) {
var $el = $(this.el);
var $spage = val && val.wrap ? $(val.wrap) : $el.closest(".vc-spage");
$el.off("click.spage.vc").on("click.spage.vc", function (event) {
event.preventDefault();
event.stopPropagation();
$spage.hide();
$spage.siblings(".vc-mpage:first").show();
});
});
Vue.directive('table-status-desc', {
update: function (newValue) {
var $el = $(this.el);
switch (newValue) {
case "loading":
$el.text("加载中...");
break;
case "loaded0":
$el.text("没有数据");
break;
case "fail":
$el.text("加载数据失败");
break;
default:
$el.text("");
break;
}
}
});
Vue.filter('money', function (value) {
return value ? value.toFixed(2) : value;
});
//filter
// 注册
Vue.filter('FixNumber', function (desc) {
// 返回处理后的值
if (desc !== "" && desc !== null && !isNaN(desc)) {
var value = parseFloat(desc).toFixed(2);
if (value === 0) {//防止返回值是-0.00
return "0.00";
}
return value;
}
return desc;
});
Vue.filter('FixNumber2', main.numberFormat(2, { grouping: true }));
Vue.filter('PercentNumber', main.numberFormat(2, { grouping: true, percent: true }));
Vue.filter('PercentNumber3', main.numberFormat(3, { grouping: true, percent: true }));
Vue.filter('PercentNumber4', main.numberFormat(4, { grouping: true, percent: true }));
Vue.filter('Fix3Number', main.numberFormat(3));
// getter,返回已注册的过滤器
Vue.filter('FixNumber', Vue.filter('FixNumber'));
Vue.filter('formatDate', function (time) {
var momDate = new moment(time);
if (!momDate.isValid() || typeof time === "undefined") return "/";
return momDate.format("YYYY-MM-DD");
});
Vue.filter('formatDate', Vue.filter('formatDate'));
Vue.filter('ToUnderlyingInstrumentTypeCn', function (UnderlyingInstrumentType) {
if (UnderlyingInstrumentType === "Stock") return "股票";
return "商品期货";
});
Vue.filter('ToUnderlyingInstrumentTypeCn', Vue.filter('ToUnderlyingInstrumentTypeCn'));
Vue.filter('ToIntEx', function (desc) {
return numeral(desc).format("0,0");
});