Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
陈庄旺
uni-app
提交
92a95f26
U
uni-app
项目概览
陈庄旺
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
92a95f26
编写于
7月 30, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): nvue
上级
e24c7793
变更
36
展开全部
隐藏空白更改
内联
并排
Showing
36 changed file
with
900 addition
and
592 deletion
+900
-592
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+412
-411
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+53
-73
packages/uni-app-plus/src/service/framework/app/utils.ts
packages/uni-app-plus/src/service/framework/app/utils.ts
+4
-5
packages/uni-cli-nvue/dist/index.js
packages/uni-cli-nvue/dist/index.js
+1
-1
packages/uni-cli-nvue/dist/utils.js
packages/uni-cli-nvue/dist/utils.js
+11
-0
packages/uni-cli-nvue/dist/webpack/alias.js
packages/uni-cli-nvue/dist/webpack/alias.js
+18
-0
packages/uni-cli-nvue/dist/webpack/config/index.js
packages/uni-cli-nvue/dist/webpack/config/index.js
+4
-4
packages/uni-cli-nvue/dist/webpack/config/module/index.js
packages/uni-cli-nvue/dist/webpack/config/module/index.js
+7
-4
packages/uni-cli-nvue/dist/webpack/config/module/rules/babelLoader.js
...-cli-nvue/dist/webpack/config/module/rules/babelLoader.js
+14
-11
packages/uni-cli-nvue/dist/webpack/config/module/rules/index.js
...es/uni-cli-nvue/dist/webpack/config/module/rules/index.js
+5
-2
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader.js
...ni-cli-nvue/dist/webpack/config/module/rules/vueLoader.js
+0
-15
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/index.js
...ck/config/module/rules/vueLoader/compilerOptions/index.js
+10
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/assetUrl.js
...odule/rules/vueLoader/compilerOptions/modules/assetUrl.js
+7
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/boolAttr.js
...odule/rules/vueLoader/compilerOptions/modules/boolAttr.js
+7
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/easycom.js
...module/rules/vueLoader/compilerOptions/modules/easycom.js
+17
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/index.js
...g/module/rules/vueLoader/compilerOptions/modules/index.js
+19
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/renderWhole.js
...le/rules/vueLoader/compilerOptions/modules/renderWhole.js
+32
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/tags.js
...ig/module/rules/vueLoader/compilerOptions/modules/tags.js
+109
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/easycom.js
...vue/dist/webpack/config/module/rules/vueLoader/easycom.js
+41
-0
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/index.js
...-nvue/dist/webpack/config/module/rules/vueLoader/index.js
+46
-0
packages/uni-cli-nvue/dist/webpack/config/optimization.js
packages/uni-cli-nvue/dist/webpack/config/optimization.js
+15
-12
packages/uni-cli-nvue/dist/webpack/config/output.js
packages/uni-cli-nvue/dist/webpack/config/output.js
+8
-5
packages/uni-cli-nvue/dist/webpack/config/plugins/banner.js
packages/uni-cli-nvue/dist/webpack/config/plugins/banner.js
+9
-6
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
+8
-5
packages/uni-cli-nvue/dist/webpack/config/plugins/index.js
packages/uni-cli-nvue/dist/webpack/config/plugins/index.js
+10
-7
packages/uni-cli-nvue/dist/webpack/config/plugins/provide.js
packages/uni-cli-nvue/dist/webpack/config/plugins/provide.js
+12
-17
packages/uni-cli-nvue/dist/webpack/config/plugins/vueLoader.js
...ges/uni-cli-nvue/dist/webpack/config/plugins/vueLoader.js
+6
-3
packages/uni-cli-nvue/dist/webpack/index.js
packages/uni-cli-nvue/dist/webpack/index.js
+4
-0
packages/uni-cli-nvue/lib/vue-loader/lib/index.d.ts
packages/uni-cli-nvue/lib/vue-loader/lib/index.d.ts
+1
-1
packages/uni-cli-nvue/src/webpack/config/module/rules/vueLoader/index.ts
...i-nvue/src/webpack/config/module/rules/vueLoader/index.ts
+1
-1
packages/uni-core/src/helpers/bridge.ts
packages/uni-core/src/helpers/bridge.ts
+0
-1
packages/uni-core/src/service/bridge/subscribeServiceMethod.ts
...ges/uni-core/src/service/bridge/subscribeServiceMethod.ts
+0
-1
packages/uni-core/src/view/bridge/subscribeViewMethod.ts
packages/uni-core/src/view/bridge/subscribeViewMethod.ts
+0
-1
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+3
-2
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+3
-2
packages/uni-h5/src/framework/components/page/pageHead.tsx
packages/uni-h5/src/framework/components/page/pageHead.tsx
+3
-2
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
92a95f26
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
92a95f26
...
...
@@ -183,7 +183,7 @@
fonts.add(fontFace);
});
}
return new Promise((resolve
2
) => {
return new Promise((resolve) => {
const style = document.createElement("style");
const values = [];
if (desc) {
...
...
@@ -197,7 +197,7 @@
}
style.innerText = `@font-face{font-family:"${family}";src:${source};${values.join(";")}}`;
document.head.appendChild(style);
resolve
2
();
resolve();
});
}
function scrollTo(scrollTop, duration) {
...
...
@@ -715,9 +715,6 @@
emitter.off(`${subscribeNamespace}.${event}`, callback);
},
subscribeHandler(event, args, pageId) {
{
console.log(formatLog(subscribeNamespace, "subscribeHandler", pageId, event, args));
}
emitter.emit(`${subscribeNamespace}.${event}`, args, pageId);
}
};
...
...
@@ -762,9 +759,6 @@
handler(args, publish);
} else {
publish({});
{
console.error(formatLog("invokeViewMethod", name, "not register"));
}
}
}
const ViewJSBridge = /* @__PURE__ */ extend(initBridge("service"), {
...
...
@@ -4055,31 +4049,7 @@
return result;
}
const isTeleport = (type) => type.__isTeleport;
const COMPONENTS = "components";
function resolveComponent(name, maybeSelfReference) {
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
}
const NULL_DYNAMIC_COMPONENT = Symbol();
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
const instance = currentRenderingInstance || currentInstance;
if (instance) {
const Component = instance.type;
if (type === COMPONENTS) {
const selfName = getComponentName(Component);
if (selfName && (selfName === name || selfName === camelize(name) || selfName === capitalize(camelize(name)))) {
return Component;
}
}
const res = resolve(instance[type] || Component[type], name) || resolve(instance.appContext[type], name);
if (!res && maybeSelfReference) {
return Component;
}
return res;
}
}
function resolve(registry, name) {
return registry && (registry[name] || registry[camelize(name)] || registry[capitalize(camelize(name))]);
}
const Fragment = Symbol(void 0);
const Text$1 = Symbol(void 0);
const Comment$1 = Symbol(void 0);
...
...
@@ -7271,7 +7241,7 @@
function actionsChanged({
actions,
reserve
}, resolve
2
) {
}, resolve) {
if (!actions) {
return;
}
...
...
@@ -7322,7 +7292,7 @@
});
color = LinearGradient;
} else if (data[0] === "pattern") {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve
2
, function(image2) {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
c2d[method1] = c2d.createPattern(image2, data[2]);
}
...
...
@@ -7371,7 +7341,7 @@
var url = dataArray[0];
var otherData = dataArray.slice(1);
_images = _images || {};
if (checkImageLoaded(url, actions.slice(index2 + 1), resolve
2
, function(image2) {
if (checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
c2d.drawImage.apply(c2d, [image2].concat([...otherData.slice(4, 8)], [...otherData.slice(0, 4)]));
}
...
...
@@ -7393,7 +7363,7 @@
}
}
if (!actionsWaiting.value) {
resolve
2
({
resolve({
errMsg: "drawCanvas:ok"
});
}
...
...
@@ -7435,7 +7405,7 @@
}
});
}
function checkImageLoaded(src, actions, resolve
2
, fn) {
function checkImageLoaded(src, actions, resolve, fn) {
var image2 = _images[src];
if (image2.ready) {
fn(image2);
...
...
@@ -7453,7 +7423,7 @@
actionsChanged({
actions: action[0],
reserve: action[1]
}, resolve
2
);
}, resolve);
action = actions2.shift();
}
};
...
...
@@ -7471,7 +7441,7 @@
dataType,
quality = 1,
type = "png"
}, resolve
2
) {
}, resolve) {
const canvas2 = canvasRef.value;
let data;
const maxWidth = canvas2.offsetWidth - x;
...
...
@@ -7528,10 +7498,10 @@
}
newCanvas.height = newCanvas.width = 0;
context.__hidpi__ = false;
if (!resolve
2
) {
if (!resolve) {
return result;
} else {
resolve
2
(result);
resolve(result);
}
}
function putImageData({
...
...
@@ -7541,7 +7511,7 @@
width,
height,
compressed
}, resolve
2
) {
}, resolve) {
try {
if (!height) {
height = Math.round(data.length / 4 / width);
...
...
@@ -7556,12 +7526,12 @@
canvasRef.value.getContext("2d").drawImage(canvas2, x, y, width, height);
canvas2.height = canvas2.width = 0;
} catch (error) {
resolve
2
({
resolve({
errMsg: "canvasPutImageData:fail"
});
return;
}
resolve
2
({
resolve({
errMsg: "canvasPutImageData:ok"
});
}
...
...
@@ -7575,7 +7545,7 @@
fileType,
quality,
dirname
}, resolve
2
) {
}, resolve) {
const res = getImageData({
x,
y,
...
...
@@ -7589,7 +7559,7 @@
quality
});
if (!res.data || !res.data.length) {
resolve
2
({
resolve({
errMsg: res.errMsg.replace("canvasPutImageData", "toTempFilePath")
});
return;
...
...
@@ -7602,10 +7572,10 @@
putImageData,
toTempFilePath
};
function _handleSubscribe(type, data, resolve
2
) {
function _handleSubscribe(type, data, resolve) {
let method = methods2[type];
if (type.indexOf("_") !== 0 && typeof method === "function") {
method(data, resolve
2
);
method(data, resolve);
}
}
return extend(methods2, {
...
...
@@ -8524,7 +8494,7 @@
});
});
const id2 = useContextInfo();
useSubscribe((type, data, resolve
2
) => {
useSubscribe((type, data, resolve) => {
const { options, callbackId } = data;
let res;
let range;
...
...
@@ -8661,7 +8631,7 @@
errMsg = "not ready";
}
if (callbackId) {
resolve
2
({
resolve({
callbackId,
data: extend({}, res, {
errMsg: `${type}:${errMsg ? "fail " + errMsg : "ok"}`
...
...
@@ -9107,17 +9077,17 @@
uniForm.removeField(ctx);
});
}
function getSelectedTextRange(_, resolve
2
) {
function getSelectedTextRange(_, resolve) {
const activeElement = document.activeElement;
if (!activeElement) {
return resolve
2
({});
return resolve({});
}
const data = {};
if (["input", "textarea"].includes(activeElement.tagName.toLowerCase())) {
data.start = activeElement.selectionStart;
data.end = activeElement.selectionEnd;
}
resolve
2
(data);
resolve(data);
}
const UniViewJSBridgeSubscribe = function() {
registerViewMethod(getCurrentPageId(), "getSelectedTextRange", getSelectedTextRange);
...
...
@@ -14253,8 +14223,8 @@
if (!name) {
return;
}
registerViewMethod(pageId || getCurrentPageId(), name, ({ type, data }, resolve
2
) => {
callback(type, data, resolve
2
);
registerViewMethod(pageId || getCurrentPageId(), name, ({ type, data }, resolve) => {
callback(type, data, resolve);
});
}
function removeSubscribe(name) {
...
...
@@ -15315,9 +15285,14 @@
_setMap
} = useMapMethods(props2, trigger2);
onParentReady(() => {
map2 = extend(plus.maps.create(getCurrentPageId() + "-map-" + (props2.id || Date.now()), Object.assign({}, attrs2.value, position)), {
map2 = extend(plus.maps.create(getCurrentPageId() + "-map-" + (props2.id || Date.now()), Object.assign({}, attrs2.value, position, (() => {
if (props2.latitude && props2.longitude) {
return {
center: new plus.maps.Point(Number(props2.longitude), Number(props2.latitude))
};
}
})())), {
__markers__: [],
__markers_map__: {},
__lines__: [],
__circles__: []
});
...
...
@@ -15342,7 +15317,7 @@
watch(() => position, (position2) => map2 && map2.setStyles(position2), {
deep: true
});
watch(
() => hidden.value
, (val) => {
watch(
hidden
, (val) => {
map2 && map2[val ? "hide" : "show"]();
});
watch(() => props2.scale, (val) => {
...
...
@@ -15355,12 +15330,18 @@
});
watch(() => props2.markers, (val) => {
_addMarkers(val, true);
}, {
deep: true
});
watch(() => props2.polyline, (val) => {
_addMapLines(val);
}, {
deep: true
});
watch(() => props2.circles, (val) => {
_addMapCircles(val);
}, {
deep: true
});
});
const mapControls = computed$1(() => props2.controls.map((control) => {
...
...
@@ -15375,7 +15356,8 @@
return {
id: control.id,
iconPath: getRealPath(control.iconPath),
position: position2
position: position2,
clickable: control.clickable
};
}));
onBeforeUnmount(() => {
...
...
@@ -15392,12 +15374,12 @@
default: () => [createVNode("div", {
"ref": containerRef,
"class": "uni-map-container"
}, null, 512), mapControls.value.map((control, index2) => createVNode(
resolveComponent("v-uni-cover-image")
, {
}, null, 512), mapControls.value.map((control, index2) => createVNode(
CoverImage
, {
"key": index2,
"src": control.iconPath,
"style": control.position,
"auto-size": true,
"onClick": () => trigger2("controltap", {}, {
"onClick": () =>
control.clickable &&
trigger2("controltap", {}, {
controlId: control.id
})
}, null, 8, ["src", "style", "auto-size", "onClick"])), createVNode("div", {
...
...
@@ -15410,42 +15392,42 @@
});
function useMapMethods(props2, trigger2) {
let map2;
function moveToLocation(resolve
2
, {
function moveToLocation(resolve, {
longitude,
latitude
} = {}) {
if (!map2)
return;
map2.setCenter(new plus.maps.Point(Number(longitude || props2.longitude), Number(latitude || props2.latitude)));
resolve
2
({
resolve({
errMsg: "moveToLocation:ok"
});
}
function getCenterLocation(resolve
2
) {
function getCenterLocation(resolve) {
if (!map2)
return;
map2.getCurrentCenter((state, point) => {
resolve
2
({
resolve({
longitude: point.getLng(),
latitude: point.getLat(),
errMsg: "getCenterLocation:ok"
});
});
}
function getRegion(resolve
2
) {
function getRegion(resolve) {
if (!map2)
return;
const rect = map2.getBounds();
resolve
2
({
resolve({
southwest: rect.getSouthWest(),
northeast: rect.getNorthEast(),
errMsg: "getRegion:ok"
});
}
function getScale(resolve
2
) {
function getScale(resolve) {
if (!map2)
return;
resolve
2
({
resolve({
scale: map2.getZoom(),
errMsg: "getScale:ok"
});
...
...
@@ -15496,7 +15478,6 @@
}
map2 == null ? void 0 : map2.addOverlay(nativeMarker);
map2.__markers__.push(nativeMarker);
map2 && (map2.__markers_map__[id2 + ""] = nativeMarker);
});
}
function _clearMarkers() {
...
...
@@ -15507,7 +15488,6 @@
map2 == null ? void 0 : map2.removeOverlay(marker);
});
map2.__markers__ = [];
map2.__markers_map__ = {};
}
function _addMarkers(markers, clear2) {
if (clear2) {
...
...
@@ -15587,8 +15567,8 @@
getRegion,
getScale
};
useSubscribe((type, data, resolve
2
) => {
methods2[type] && methods2[type](resolve
2
, data);
useSubscribe((type, data, resolve) => {
methods2[type] && methods2[type](resolve, data);
}, useContextInfo(), true);
return {
_addMarkers,
...
...
packages/uni-app-plus/src/service/framework/app/utils.ts
浏览文件 @
92a95f26
export
const
EVENT_BACKBUTTON
=
'
backbutton
'
export
function
backbuttonListener
()
{
uni
.
navigateBack
({
from
:
'
backbutton
'
,
}
as
UniApp
.
NavigateBackOptions
)
.
catch
(()
=>
{})
uni
.
navigateBack
({
from
:
'
backbutton
'
,
success
()
{},
// 传入空方法,避免返回Promise,因为onBackPress可能导致fail
}
as
UniApp
.
NavigateBackOptions
)
}
packages/uni-cli-nvue/dist/index.js
浏览文件 @
92a95f26
...
...
@@ -11,6 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
};
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
/**
* 注意:该包的依赖包含了 lib 中的
vue-loader,weex-styler,weex-template-compiler
* 注意:该包的依赖包含了 lib 中的
weex-template-compiler 依赖的 de-indent
*/
__exportStar
(
require
(
"
./webpack
"
),
exports
);
packages/uni-cli-nvue/dist/utils.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
var
__importDefault
=
(
this
&&
this
.
__importDefault
)
||
function
(
mod
)
{
return
(
mod
&&
mod
.
__esModule
)
?
mod
:
{
"
default
"
:
mod
};
};
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
resolveLib
=
void
0
;
const
path_1
=
__importDefault
(
require
(
"
path
"
));
function
resolveLib
(
filepath
)
{
return
path_1
.
default
.
resolve
(
__dirname
,
'
../lib
'
,
filepath
);
}
exports
.
resolveLib
=
resolveLib
;
packages/uni-cli-nvue/dist/webpack/alias.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
var
__importDefault
=
(
this
&&
this
.
__importDefault
)
||
function
(
mod
)
{
return
(
mod
&&
mod
.
__esModule
)
?
mod
:
{
"
default
"
:
mod
};
};
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
initModuleAlias
=
void
0
;
const
module_alias_1
=
__importDefault
(
require
(
"
module-alias
"
));
const
utils_1
=
require
(
"
../utils
"
);
const
MODULES
=
[
'
weex-styler
'
,
'
weex-template-compiler
'
,
'
@vue/component-compiler-utils
'
,
'
@vue/component-compiler-utils/package.json
'
,
];
function
initModuleAlias
()
{
MODULES
.
forEach
((
name
)
=>
module_alias_1
.
default
.
addAlias
(
name
,
utils_1
.
resolveLib
(
name
)));
}
exports
.
initModuleAlias
=
initModuleAlias
;
packages/uni-cli-nvue/dist/webpack/config/index.js
浏览文件 @
92a95f26
...
...
@@ -16,10 +16,10 @@ function createConfig(mode) {
externals
:
{
vue
:
'
Vue
'
,
},
optimization
:
optimization_1
.
optimization
,
output
:
output_1
.
output
,
module
:
module_1
.
module
,
plugins
:
plugins_1
.
plugins
,
optimization
:
optimization_1
.
createOptimization
()
,
output
:
output_1
.
createOutput
()
,
module
:
module_1
.
createModule
()
,
plugins
:
plugins_1
.
createPlugins
()
,
};
}
exports
.
createConfig
=
createConfig
;
packages/uni-cli-nvue/dist/webpack/config/module/index.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
m
odule
=
void
0
;
exports
.
createM
odule
=
void
0
;
const
rules_1
=
require
(
"
./rules
"
);
exports
.
module
=
{
rules
:
rules_1
.
rules
,
};
function
createModule
()
{
return
{
rules
:
rules_1
.
createRules
(),
};
}
exports
.
createModule
=
createModule
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/babelLoader.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
babelLoader
=
void
0
;
exports
.
babelLoader
=
{
test
:
/
\.
js$/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
{
babelrc
:
false
,
exports
.
createBabelLoader
=
void
0
;
function
createBabelLoader
()
{
return
{
test
:
/
\.
js$/
,
use
:
[
{
loader
:
'
babel-loader
'
,
options
:
{
babelrc
:
false
,
},
},
},
],
};
],
};
}
exports
.
createBabelLoader
=
createBabelLoader
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/index.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
r
ules
=
void
0
;
exports
.
createR
ules
=
void
0
;
const
babelLoader_1
=
require
(
"
./babelLoader
"
);
const
vueLoader_1
=
require
(
"
./vueLoader
"
);
exports
.
rules
=
[
vueLoader_1
.
vueLoader
,
babelLoader_1
.
babelLoader
];
function
createRules
()
{
return
[
vueLoader_1
.
createVueLoader
(),
babelLoader_1
.
createBabelLoader
()];
}
exports
.
createRules
=
createRules
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader.js
已删除
100644 → 0
浏览文件 @
e24c7793
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
vueLoader
=
void
0
;
exports
.
vueLoader
=
{
test
:
[
/
\.
nvue
(\?[^
?
]
+
)?
$/
,
/
\.
vue
(\?[^
?
]
+
)?
$/
],
use
:
[
{
loader
:
'
vue-loader
'
,
options
:
{
hotReload
:
false
,
compiler
:
require
(
'
../../../../../lib/weex-template-compiler
'
),
},
},
],
};
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/index.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createCompilerOptions
=
void
0
;
const
modules_1
=
require
(
"
./modules
"
);
function
createCompilerOptions
()
{
return
{
modules
:
modules_1
.
createModules
(),
};
}
exports
.
createCompilerOptions
=
createCompilerOptions
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/assetUrl.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createAssetUrlModule
=
void
0
;
function
createAssetUrlModule
()
{
return
{};
}
exports
.
createAssetUrlModule
=
createAssetUrlModule
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/boolAttr.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createBoolAttrModule
=
void
0
;
function
createBoolAttrModule
()
{
return
{};
}
exports
.
createBoolAttrModule
=
createBoolAttrModule
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/easycom.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createEasycomModule
=
void
0
;
const
uni_shared_1
=
require
(
"
@dcloudio/uni-shared
"
);
function
createEasycomModule
()
{
return
{
preTransformNode
(
el
,
options
)
{
if
(
uni_shared_1
.
isBuiltInComponent
(
el
.
tag
)
&&
el
.
tag
!==
'
App
'
)
{
// 挂在 isUnaryTag 上边,可以保证外部访问到
;
(
options
.
isUnaryTag
.
autoComponents
||
(
options
.
isUnaryTag
.
autoComponents
=
new
Set
())).
add
(
el
.
tag
);
}
},
};
}
exports
.
createEasycomModule
=
createEasycomModule
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/index.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createModules
=
void
0
;
const
assetUrl_1
=
require
(
"
./assetUrl
"
);
const
boolAttr_1
=
require
(
"
./boolAttr
"
);
const
easycom_1
=
require
(
"
./easycom
"
);
const
renderWhole_1
=
require
(
"
./renderWhole
"
);
const
tags_1
=
require
(
"
./tags
"
);
function
createModules
()
{
// 先处理 easycom
const
modules
=
[
easycom_1
.
createEasycomModule
(),
renderWhole_1
.
createRenderWholeModule
()];
if
(
process
.
env
.
UNI_NVUE_COMPILER
===
'
uni-app
'
)
{
modules
.
push
(
tags_1
.
createTagsModule
());
}
modules
.
push
(
assetUrl_1
.
createAssetUrlModule
());
modules
.
push
(
boolAttr_1
.
createBoolAttrModule
());
return
modules
;
}
exports
.
createModules
=
createModules
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/renderWhole.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createRenderWholeModule
=
void
0
;
// render-whole => append="tree"
function
createRenderWholeModule
()
{
return
{
preTransformNode
(
el
)
{
if
(
!
Object
.
hasOwnProperty
.
call
(
el
.
attrsMap
,
'
append
'
))
{
const
name
=
'
render-whole
'
;
const
value
=
el
.
attrsMap
[
name
];
if
(
value
===
true
||
value
===
'
true
'
)
{
// remove
delete
el
.
attrsMap
.
append
;
const
index
=
el
.
attrsList
.
findIndex
((
item
)
=>
item
.
name
===
name
);
const
attr
=
el
.
attrsList
[
index
];
el
.
attrsList
.
splice
(
index
,
1
);
el
.
appendAsTree
=
true
;
el
.
attrsMap
.
append
=
'
tree
'
;
el
.
attrsList
.
push
({
name
:
'
append
'
,
value
:
'
tree
'
,
bool
:
false
,
start
:
attr
.
start
,
end
:
attr
.
end
,
});
}
}
return
el
;
},
};
}
exports
.
createRenderWholeModule
=
createRenderWholeModule
;
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/compilerOptions/modules/tags.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createTagsModule
=
void
0
;
function
createTagsModule
()
{
return
{
postTransformNode
(
el
)
{
rewriteText
(
el
);
rewriteTag
(
el
);
rewriteEvents
(
el
);
rewriteVideo
(
el
);
},
};
}
exports
.
createTagsModule
=
createTagsModule
;
function
rewriteText
(
el
)
{
const
tag
=
el
.
tag
;
if
(
tag
===
'
text
'
||
tag
===
'
u-text
'
||
tag
===
'
button
'
)
{
return
;
}
const
children
=
el
.
children
;
children
.
forEach
((
child
,
index
)
=>
{
if
(
child
.
text
)
{
children
.
splice
(
index
,
1
,
{
type
:
1
,
tag
:
'
u-text
'
,
attrsList
:
[],
attrsMap
:
{},
rawAttrsMap
:
{},
parent
:
el
,
children
:
[
child
],
plain
:
true
,
});
}
});
}
const
TAGS
=
[
'
text
'
,
'
image
'
,
'
input
'
,
'
textarea
'
,
'
video
'
,
'
web-view
'
,
// 'switch',
'
slider
'
,
];
function
rewriteTag
(
el
)
{
if
(
TAGS
.
includes
(
el
.
tag
))
{
el
.
tag
=
'
u-
'
+
el
.
tag
;
}
else
if
(
el
.
tag
===
'
match-media
'
)
{
el
.
tag
=
'
uni-match-media
'
;
}
}
const
deprecated
=
{
events
:
{
tap
:
'
click
'
,
},
};
function
rewriteEvents
(
el
)
{
if
(
!
el
.
events
)
{
return
;
}
const
{
events
:
eventsMap
}
=
deprecated
;
Object
.
keys
(
el
.
events
).
forEach
((
name
)
=>
{
// 过时事件类型转换
const
eventType
=
eventsMap
[
name
];
if
(
eventType
)
{
if
(
!
(
name
===
'
tap
'
&&
el
.
tag
===
'
map
'
))
{
// map 的 tap 事件不做转换
el
.
events
[
eventType
]
=
el
.
events
[
name
];
delete
el
.
events
[
name
];
}
}
});
}
function
rewriteVideo
(
el
)
{
if
(
el
.
tag
!==
'
u-video
'
)
{
return
;
}
if
(
!
Array
.
isArray
(
el
.
children
))
{
return
;
}
if
(
!
el
.
children
.
length
)
{
return
;
}
if
(
el
.
children
[
0
].
tag
===
'
u-scalable
'
)
{
return
;
}
el
.
children
=
[
{
type
:
1
,
tag
:
'
u-scalable
'
,
attrsList
:
[],
attrsMap
:
{
style
:
'
position: absolute;left: 0;right: 0;top: 0;bottom: 0;
'
,
},
rawAttrsMap
:
{
style
:
{
name
:
'
style
'
,
value
:
'
position: absolute;left: 0;right: 0;top: 0;bottom: 0;
'
,
},
},
parent
:
el
,
plain
:
false
,
staticStyle
:
'
{position:"absolute",left:"0",right:"0",top:"0",bottom:"0"}
'
,
children
:
el
.
children
,
},
];
}
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/easycom.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
generateEasycomCode
=
void
0
;
const
uni_cli_shared_1
=
require
(
"
@dcloudio/uni-cli-shared
"
);
function
generateEasycomCode
(
names
)
{
const
components
=
[];
resolveEasycom
(
names
).
forEach
(({
name
,
source
})
=>
{
// 统一转换为驼峰命名
name
=
name
.
replace
(
/-
(\w)
/g
,
(
_
,
str
)
=>
str
.
toUpperCase
());
components
.
push
(
`'
${
name
}
': require('
${
source
}
').default`
);
});
if
(
process
.
env
.
NODE_ENV
===
'
production
'
)
{
return
`var components = {
${
components
.
join
(
'
,
'
)}
}`
;
}
return
`var components;
try{
components = {
${
components
.
join
(
'
,
'
)}
}
}catch(e){
if(e.message.indexOf('Cannot find module') !== -1 && e.message.indexOf('.vue') !== -1){
console.error(e.message)
console.error('1. 排查组件名称拼写是否正确')
console.error('2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom')
console.error('3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件')
} else {
throw e
}
}`
;
}
exports
.
generateEasycomCode
=
generateEasycomCode
;
function
resolveEasycom
(
names
)
{
return
names
.
reduce
((
coms
,
name
)
=>
{
const
source
=
uni_cli_shared_1
.
matchEasycom
(
name
);
if
(
source
)
{
coms
.
push
({
name
,
source
,
});
}
return
coms
;
},
[]);
}
packages/uni-cli-nvue/dist/webpack/config/module/rules/vueLoader/index.js
0 → 100644
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
createVueLoader
=
void
0
;
const
shared_1
=
require
(
"
@vue/shared
"
);
const
uni_cli_shared_1
=
require
(
"
@dcloudio/uni-cli-shared
"
);
const
compilerOptions_1
=
require
(
"
./compilerOptions
"
);
const
utils_1
=
require
(
"
../../../../../utils
"
);
const
easycom_1
=
require
(
"
./easycom
"
);
function
createVueLoader
()
{
uni_cli_shared_1
.
initEasycomsOnce
(
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_PLATFORM
);
return
{
test
:
[
/
\.
nvue
(\?[^
?
]
+
)?
$/
,
/
\.
vue
(\?[^
?
]
+
)?
$/
],
use
:
[
{
loader
:
utils_1
.
resolveLib
(
'
vue-loader
'
),
options
:
{
hotReload
:
false
,
compiler
:
createCompiler
(),
compilerOptions
:
compilerOptions_1
.
createCompilerOptions
(),
},
},
],
};
}
exports
.
createVueLoader
=
createVueLoader
;
const
isUnaryTag
=
shared_1
.
makeMap
(
'
image,area,base,br,col,embed,frame,hr,img,input,isindex,keygen,
'
+
'
link,meta,param,source,track,wbr
'
);
function
compileTemplate
(
source
,
options
,
compile
)
{
const
res
=
compile
(
source
,
options
);
res
.
components
=
easycom_1
.
generateEasycomCode
([
...(
options
.
isUnaryTag
.
autoComponents
||
[]),
]);
return
res
;
}
function
createCompiler
()
{
const
compiler
=
require
(
utils_1
.
resolveLib
(
'
weex-template-compiler
'
));
const
oldCompile
=
compiler
.
compile
;
compiler
.
compile
=
function
(
source
,
options
=
{})
{
;
options
.
isUnaryTag
=
isUnaryTag
;
options
.
isUnaryTag
.
autoComponents
=
new
Set
();
options
.
preserveWhitespace
=
false
;
return
compileTemplate
(
source
,
options
,
oldCompile
);
};
return
compiler
;
}
packages/uni-cli-nvue/dist/webpack/config/optimization.js
浏览文件 @
92a95f26
...
...
@@ -3,17 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return
(
mod
&&
mod
.
__esModule
)
?
mod
:
{
"
default
"
:
mod
};
};
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
o
ptimization
=
void
0
;
exports
.
createO
ptimization
=
void
0
;
const
terser_webpack_plugin_1
=
__importDefault
(
require
(
"
terser-webpack-plugin
"
));
exports
.
optimization
=
{
nodeEnv
:
false
,
minimizer
:
[
new
terser_webpack_plugin_1
.
default
({
terserOptions
:
{
output
:
{
ascii_only
:
true
,
function
createOptimization
()
{
return
{
nodeEnv
:
false
,
minimizer
:
[
new
terser_webpack_plugin_1
.
default
({
terserOptions
:
{
output
:
{
ascii_only
:
true
,
},
},
},
}),
],
};
}),
],
};
}
exports
.
createOptimization
=
createOptimization
;
packages/uni-cli-nvue/dist/webpack/config/output.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
output
=
void
0
;
exports
.
output
=
{
path
:
process
.
env
.
UNI_OUTPUT_DIR
,
filename
:
'
[name].js
'
,
};
exports
.
createOutput
=
void
0
;
function
createOutput
()
{
return
{
path
:
process
.
env
.
UNI_OUTPUT_DIR
,
filename
:
'
[name].js
'
,
};
}
exports
.
createOutput
=
createOutput
;
packages/uni-cli-nvue/dist/webpack/config/plugins/banner.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
banner
=
void
0
;
exports
.
createBannerPlugin
=
void
0
;
const
webpack_1
=
require
(
"
webpack
"
);
exports
.
banner
=
new
webpack_1
.
BannerPlugin
({
banner
:
'
"use weex:vue";
'
,
raw
:
true
,
exclude
:
'
Vue
'
,
});
function
createBannerPlugin
()
{
return
new
webpack_1
.
BannerPlugin
({
banner
:
'
"use weex:vue";
'
,
raw
:
true
,
exclude
:
'
Vue
'
,
});
}
exports
.
createBannerPlugin
=
createBannerPlugin
;
packages/uni-cli-nvue/dist/webpack/config/plugins/define.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
define
=
void
0
;
exports
.
createDefinePlugin
=
void
0
;
const
webpack_1
=
require
(
"
webpack
"
);
const
shared_1
=
require
(
"
@vue/shared
"
);
const
uni_cli_shared_1
=
require
(
"
@dcloudio/uni-cli-shared
"
);
exports
.
define
=
new
webpack_1
.
DefinePlugin
(
shared_1
.
extend
({
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
},
uni_cli_shared_1
.
initDefine
()));
function
createDefinePlugin
()
{
return
new
webpack_1
.
DefinePlugin
(
shared_1
.
extend
({
'
process.env.UNI_CLOUD_PROVIDER
'
:
process
.
env
.
UNI_CLOUD_PROVIDER
,
'
process.env.HBX_USER_TOKEN
'
:
JSON
.
stringify
(
process
.
env
.
HBX_USER_TOKEN
||
''
),
},
uni_cli_shared_1
.
initDefine
()));
}
exports
.
createDefinePlugin
=
createDefinePlugin
;
packages/uni-cli-nvue/dist/webpack/config/plugins/index.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
p
lugins
=
void
0
;
exports
.
createP
lugins
=
void
0
;
const
define_1
=
require
(
"
./define
"
);
const
banner_1
=
require
(
"
./banner
"
);
const
provide_1
=
require
(
"
./provide
"
);
const
vueLoader_1
=
require
(
"
./vueLoader
"
);
exports
.
plugins
=
[
define_1
.
define
,
banner_1
.
banner
,
provide_1
.
provide
,
vueLoader_1
.
vueLoaderPlugin
,
];
function
createPlugins
()
{
return
[
define_1
.
createDefinePlugin
(),
banner_1
.
createBannerPlugin
(),
provide_1
.
createProvidePlugin
(),
vueLoader_1
.
createVueLoaderPlugin
(),
];
}
exports
.
createPlugins
=
createPlugins
;
packages/uni-cli-nvue/dist/webpack/config/plugins/provide.js
浏览文件 @
92a95f26
"
use strict
"
;
var
__importDefault
=
(
this
&&
this
.
__importDefault
)
||
function
(
mod
)
{
return
(
mod
&&
mod
.
__esModule
)
?
mod
:
{
"
default
"
:
mod
};
};
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
provide
=
void
0
;
const
path_1
=
__importDefault
(
require
(
"
path
"
));
exports
.
createProvidePlugin
=
void
0
;
const
webpack_1
=
require
(
"
webpack
"
);
const
uni_cli_shared_1
=
require
(
"
@dcloudio/uni-cli-shared
"
);
const
libDir
=
path_1
.
default
.
resolve
(
__dirname
,
'
../../../../lib
'
);
const
definitions
=
Object
.
assign
({
uniCloud
:
[
require
.
resolve
(
'
@dcloudio/uni-cloud/dist/uni-cloud.es.js
'
),
'
default
'
,
],
'
uni.getCurrentSubNVue
'
:
[
path_1
.
default
.
join
(
libDir
,
'
get-current-sub-nvue.js
'
),
'
default
'
,
],
'
uni.requireNativePlugin
'
:
[
path_1
.
default
.
join
(
libDir
,
'
require-native-plugin.js
'
),
'
default
'
,
]
},
uni_cli_shared_1
.
initProvide
());
exports
.
provide
=
new
webpack_1
.
ProvidePlugin
(
definitions
);
const
utils_1
=
require
(
"
../../../utils
"
);
function
createProvidePlugin
()
{
return
new
webpack_1
.
ProvidePlugin
(
Object
.
assign
({
uniCloud
:
[
require
.
resolve
(
'
@dcloudio/uni-cloud/dist/uni-cloud.es.js
'
),
'
default
'
,
],
'
uni.getCurrentSubNVue
'
:
[
utils_1
.
resolveLib
(
'
get-current-sub-nvue.js
'
),
'
default
'
],
'
uni.requireNativePlugin
'
:
[
utils_1
.
resolveLib
(
'
require-native-plugin.js
'
),
'
default
'
,
]
},
uni_cli_shared_1
.
initProvide
()));
}
exports
.
createProvidePlugin
=
createProvidePlugin
;
packages/uni-cli-nvue/dist/webpack/config/plugins/vueLoader.js
浏览文件 @
92a95f26
"
use strict
"
;
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
vueLoaderPlugin
=
void
0
;
const
{
VueLoaderPlugin
}
=
require
(
'
../../../../lib/vue-loader
'
);
exports
.
vueLoaderPlugin
=
new
VueLoaderPlugin
();
exports
.
createVueLoaderPlugin
=
void
0
;
function
createVueLoaderPlugin
()
{
const
{
VueLoaderPlugin
}
=
require
(
'
../../../../lib/vue-loader
'
);
return
new
VueLoaderPlugin
();
}
exports
.
createVueLoaderPlugin
=
createVueLoaderPlugin
;
packages/uni-cli-nvue/dist/webpack/index.js
浏览文件 @
92a95f26
...
...
@@ -5,8 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object
.
defineProperty
(
exports
,
"
__esModule
"
,
{
value
:
true
});
exports
.
runWebpackDev
=
exports
.
runWebpackBuild
=
void
0
;
const
webpack_1
=
__importDefault
(
require
(
"
webpack
"
));
const
uni_shared_1
=
require
(
"
@dcloudio/uni-shared
"
);
const
config_1
=
require
(
"
./config
"
);
const
alias_1
=
require
(
"
./alias
"
);
const
initModuleAliasOnce
=
uni_shared_1
.
once
(
alias_1
.
initModuleAlias
);
function
runWebpack
(
mode
)
{
initModuleAliasOnce
();
return
new
Promise
((
resolve
,
reject
)
=>
{
webpack_1
.
default
(
config_1
.
createConfig
(
mode
),
(
err
,
stats
)
=>
{
if
(
err
)
{
...
...
packages/uni-cli-nvue/lib/vue-loader/lib/index.d.ts
浏览文件 @
92a95f26
import
{
Plugin
}
from
'
webpack
'
// import { Plugin } from 'webpack' // fixed by xxxxxx
import
{
VueTemplateCompiler
}
from
'
@vue/component-compiler-utils/dist/types
'
import
{
CompilerOptions
}
from
'
vue-template-compiler
'
...
...
packages/uni-cli-nvue/src/webpack/config/module/rules/vueLoader/index.ts
浏览文件 @
92a95f26
import
{
RuleSetRule
}
from
'
webpack
'
import
{
VueLoaderOptions
}
from
'
vue-loader
'
import
{
makeMap
}
from
'
@vue/shared
'
import
type
{
CompilerOptions
,
CompiledResult
}
from
'
vue-template-compiler
'
import
{
initEasycomsOnce
}
from
'
@dcloudio/uni-cli-shared
'
import
{
createCompilerOptions
}
from
'
./compilerOptions
'
import
{
resolveLib
}
from
'
../../../../../utils
'
import
{
generateEasycomCode
}
from
'
./easycom
'
import
{
VueLoaderOptions
}
from
'
../../../../../../lib/vue-loader
'
export
function
createVueLoader
():
RuleSetRule
{
initEasycomsOnce
(
process
.
env
.
UNI_INPUT_DIR
,
process
.
env
.
UNI_PLATFORM
)
...
...
packages/uni-core/src/helpers/bridge.ts
浏览文件 @
92a95f26
// TODO 等待 vue3 的兼容模式自带emitter
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
E
from
'
./TinyEmitter
'
export
function
initBridge
(
...
...
packages/uni-core/src/service/bridge/subscribeServiceMethod.ts
浏览文件 @
92a95f26
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
INVOKE_SERVICE_API
}
from
'
../../constants
'
type
ServiceMethod
<
Args
=
any
,
Res
=
any
>
=
(
...
...
packages/uni-core/src/view/bridge/subscribeViewMethod.ts
浏览文件 @
92a95f26
import
{
formatLog
}
from
'
@dcloudio/uni-shared
'
import
{
INVOKE_VIEW_API
}
from
'
../../constants
'
type
ViewMethod
<
Args
=
any
,
Res
=
any
>
=
(
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
92a95f26
...
...
@@ -10583,8 +10583,9 @@ function onPageHeadBackButton() {
});
}
else
{
uni
.
navigateBack
({
from
:
"
backbutton
"
}).
catch
(()
=>
{
from
:
"
backbutton
"
,
success
()
{
}
});
}
}
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
92a95f26
...
...
@@ -20796,8 +20796,9 @@ function onPageHeadBackButton() {
});
} else {
uni.navigateBack({
from: "backbutton"
}).catch(() => {
from: "backbutton",
success() {
}
});
}
}
...
...
packages/uni-h5/src/framework/components/page/pageHead.tsx
浏览文件 @
92a95f26
...
...
@@ -248,9 +248,10 @@ function onPageHeadBackButton() {
url
:
'
/
'
,
})
}
else
{
;(
uni
.
navigateBack
as
Function
)
({
uni
.
navigateBack
({
from
:
'
backbutton
'
,
}).
catch
(()
=>
{})
success
()
{},
// 传入空方法,避免返回Promise,因为onBackPress可能导致fail
}
as
UniApp
.
NavigateBackOptions
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录