Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_38335589
uni-app
提交
a8aabcc7
U
uni-app
项目概览
weixin_38335589
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a8aabcc7
编写于
1月 22, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
build: build v3
上级
d5f1c706
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
148 addition
and
81 deletion
+148
-81
packages/uni-app-plus/dist/index.v3.js
packages/uni-app-plus/dist/index.v3.js
+148
-81
未找到文件。
packages/uni-app-plus/dist/index.v3.js
浏览文件 @
a8aabcc7
...
...
@@ -84,6 +84,7 @@ var serviceContext = (function () {
'onMemoryWarning',
'getNetworkType',
'onNetworkStatusChange',
'offNetworkStatusChange',
'onAccelerometerChange',
'offAccelerometerChange',
'startAccelerometer',
...
...
@@ -141,6 +142,7 @@ var serviceContext = (function () {
const keyboard = [
'hideKeyboard',
'onKeyboardHeightChange',
'offKeyboardHeightChange',
'getSelectedTextRange'
];
...
...
@@ -2834,6 +2836,10 @@ var serviceContext = (function () {
return res
}
function removeCallbackHandler (invokeCallbackId) {
delete invokeCallbacks[invokeCallbackId];
}
function wrapperUnimplemented (name) {
return function todo (args) {
console.error('API `' + name + '` is not yet implemented');
...
...
@@ -3152,6 +3158,10 @@ var serviceContext = (function () {
function invoke$1 (...args) {
return UniServiceJSBridge.invokeCallbackHandler(...args)
}
function remove (args) {
return UniServiceJSBridge.removeCallbackHandler(args)
}
function requireNativePlugin (name) {
...
...
@@ -3248,6 +3258,13 @@ var serviceContext = (function () {
return ret
}
function getWebview (__page__) {
if (__page__) {
return __page__.$getAppWebview()
}
return getLastWebview()
}
function getLastWebview () {
try {
const pages = getCurrentPages();
...
...
@@ -4923,6 +4940,7 @@ var serviceContext = (function () {
}] : []
},
popGesture: 'close',
background: '#000000',
backButtonAutoControl: 'close'
},
onMessage ({
...
...
@@ -5462,7 +5480,8 @@ var serviceContext = (function () {
right: safeAreaInsets.right,
bottom: safeAreaInsets.bottom,
left: safeAreaInsets.left
}
},
uuid: plus.runtime.getDCloudId()
}
}
...
...
@@ -6278,6 +6297,8 @@ var serviceContext = (function () {
}
plus.gallery.save(res.url, function (GallerySaveEvent) {
plus.nativeUI.toast('保存图片到相册成功');
}, function () {
plus.nativeUI.toast('保存图片到相册失败');
});
} else if (hasLongPressActions) {
publish(longPressActions.callbackId, {
...
...
@@ -6365,15 +6386,9 @@ var serviceContext = (function () {
function saveImageToPhotosAlbum$1 ({
filePath
} = {}, callbackId) {
plus.gallery.save(getRealPath$1(filePath), e => {
invoke$1(callbackId, {
errMsg: 'saveImageToPhotosAlbum:ok'
});
}, e => {
invoke$1(callbackId, {
errMsg: 'saveImageToPhotosAlbum:fail'
});
});
const successCallback = warpPlusSuccessCallback(callbackId, 'saveImageToPhotosAlbum');
const errorCallback = warpPlusErrorCallback(callbackId, 'saveImageToPhotosAlbum');
plus.gallery.save(getRealPath$1(filePath), successCallback, errorCallback);
}
function saveVideoToPhotosAlbum ({
...
...
@@ -7632,7 +7647,7 @@ var serviceContext = (function () {
function parseTitleNView (routeOptions) {
const windowOptions = routeOptions.window;
const titleNView = windowOptions.titleNView;
const titleNView = windowOptions.titleNView;
routeOptions.meta.statusBarStyle = windowOptions.navigationBarTextStyle === 'black' ? 'dark' : 'light';
if ( // 无头
titleNView === false ||
...
...
@@ -7656,12 +7671,13 @@ var serviceContext = (function () {
always: 'float'
};
const navigationBarBackgroundColor = windowOptions.navigationBarBackgroundColor;
const ret = {
autoBackButton: !routeOptions.meta.isQuit,
titleText: titleImage === '' ? windowOptions.navigationBarTitleText || '' : '',
titleColor: windowOptions.navigationBarTextStyle === 'black' ? '#000000' : '#ffffff',
type: titleNViewTypeList[transparentTitle],
backgroundColor:
windowOptions.navigationBarBackgroundColor || '#f8f8f8
',
backgroundColor:
(/^#[a-z0-9]{6}$/i.test(navigationBarBackgroundColor) || navigationBarBackgroundColor === 'transparent') ? navigationBarBackgroundColor : '#f7f7f7
',
tags: titleImage === '' ? [] : [{
tag: 'img',
src: titleImage,
...
...
@@ -7781,7 +7797,7 @@ var serviceContext = (function () {
});
const backgroundColor = routeOptions.window.backgroundColor;
if (
backgroundColor
) {
if (
/^#[a-z0-9]{6}$/i.test(backgroundColor) || backgroundColor === 'transparent'
) {
if (!webviewStyle.background) {
webviewStyle.background = backgroundColor;
}
...
...
@@ -9384,9 +9400,10 @@ var serviceContext = (function () {
}
function setNavigationBarTitle$1 ({
__page__,
title = ''
} = {}) {
const webview = get
LastWebview(
);
const webview = get
Webview(__page__
);
if (webview) {
const style = webview.getStyle();
if (style && style.titleNView) {
...
...
@@ -9430,11 +9447,12 @@ var serviceContext = (function () {
pages[pages.length - 1].$page.meta.statusBarStyle = statusBarStyle;
}
function setNavigationBarColor$1 ({
function setNavigationBarColor$1 ({
__page__,
frontColor,
backgroundColor
} = {}) {
const webview = get
LastWebview(
);
const webview = get
Webview(__page__
);
if (webview) {
const styles = {};
if (frontColor) {
...
...
@@ -9880,6 +9898,55 @@ var serviceContext = (function () {
: requestComponentInfo(pageVm, queue, callback);
}
function operateAdView (pageId, id, type, data) {
UniServiceJSBridge.publishHandler(id, {
type,
data
}, pageId);
}
UniServiceJSBridge.subscribe('onAdMethodCallback', ({
callbackId,
data
}, pageId) => {
const { adpid, width, count } = data;
getAdData(adpid, width, count, (res) => {
operateAdView(pageId, callbackId, 'success', res);
}, (err) => {
operateAdView(pageId, callbackId, 'fail', err);
});
});
const _adDataCache = {};
function getAdData (adpid, width, count, onsuccess, onerror) {
const key = adpid + '-' + width;
const adDataList = _adDataCache[key];
if (adDataList && adDataList.length > 0) {
onsuccess(adDataList.splice(0, 1)[0]);
return
}
plus.ad.getAds(
{
adpid,
count,
width
},
(res) => {
const list = res.ads;
onsuccess(list.splice(0, 1)[0]);
_adDataCache[key] = adDataList ? adDataList.concat(list) : list;
},
(err) => {
onerror({
errCode: err.code,
errMsg: err.message
});
}
);
}
const eventNames = [
'load',
'close',
...
...
@@ -18306,7 +18373,7 @@ var serviceContext = (function () {
callback.invoke(callbackId, data);
});
const methods$1 = ['insertDivider', 'insertImage', 'insertText', 'setContents', 'getContents', 'clear', 'removeFormat', 'undo', 'redo'];
const methods$1 = ['insertDivider', 'insertImage', 'insertText', 'setContents', 'getContents', 'clear', 'removeFormat', 'undo', 'redo'
, 'blur', 'getSelectionText', 'scrollIntoView'
];
class EditorContext {
constructor (id, pageId) {
...
...
@@ -18538,11 +18605,22 @@ var serviceContext = (function () {
function onNetworkStatusChange (callbackId) {
callbacks$6.push(callbackId);
}
function offNetworkStatusChange (callbackId) {
// 暂不支持移除所有监听
if (callbackId) {
const index = callbacks$6.indexOf(callbackId);
if (index >= 0) {
callbacks$6.splice(index, 1);
}
}
}
var require_context_module_1_11 = /*#__PURE__*/Object.freeze({
__proto__: null,
onNetworkStatusChange: onNetworkStatusChange
onNetworkStatusChange: onNetworkStatusChange,
offNetworkStatusChange: offNetworkStatusChange
});
const callbacks$7 = [];
...
...
@@ -18612,12 +18690,20 @@ var serviceContext = (function () {
});
function onKeyboardHeightChange (callbackId) {
// 与微信小程序一致仅保留最后一次监听
remove(callback$1);
callback$1 = callbackId;
}
function offKeyboardHeightChange () {
// 与微信小程序一致移除最后一次监听
callback$1 = null;
}
var require_context_module_1_14 = /*#__PURE__*/Object.freeze({
__proto__: null,
onKeyboardHeightChange: onKeyboardHeightChange
onKeyboardHeightChange: onKeyboardHeightChange,
offKeyboardHeightChange: offKeyboardHeightChange
});
const longPressActionsCallbackId = 'longPressActionsCallback';
...
...
@@ -20593,6 +20679,26 @@ var serviceContext = (function () {
return event
}
function generateId (vm, parent, version) {
if (!vm.$parent) {
return '-1'
}
const vnode = vm.$vnode;
const context = vnode.context;
let id = vnode.data.attrs._i;
if (version && hasOwn(vnode.data, 'key')) { // 补充 key 值
id = id + ';' + vnode.data.key;
}
// slot 内的组件,需要补充 context 的 id,否则可能与内部组件索引值一致,导致 id 冲突
if (context && context !== parent && context._$id) {
if (process.env.NODE_ENV !== 'production') {
console.log('generateId:' + context._$id + ';' + parent._$id + ',' + id);
}
return context._$id + ';' + parent._$id + ',' + id
}
return parent._$id + ',' + id
}
const isAndroid = plus.os.name.toLowerCase() === 'android';
const FOCUS_TIMEOUT = isAndroid ? 300 : 700;
let keyboardHeight = 0;
...
...
@@ -20639,32 +20745,7 @@ var serviceContext = (function () {
// }
}
// TODO 临时通过序列化,反序列化传递dataset,后续可以全部保留在service,不做传递
function parseDataset$1 (dataset) {
const ret = Object.create(null);
Object.keys(dataset).forEach(name => {
try {
ret[name] = JSON.parse(dataset[name]);
} catch (e) { // dataset 存在两种,一种是被JSON.stringify的,一种是原始的
ret[name] = dataset[name];
}
});
return ret
}
function parseTargets (event) {
const targetDataset = event.target && event.target.dataset;
if (targetDataset) {
event.target.dataset = parseDataset$1(targetDataset);
}
const currentTargetDataset = event.currentTarget && event.currentTarget.dataset;
if (currentTargetDataset) {
event.currentTarget.dataset = parseDataset$1(currentTargetDataset);
}
}
function wrapperEvent (event) {
parseTargets(event);
event.preventDefault = noop;
event.stopPropagation = noop;
return wrapperMPEvent(event)
...
...
@@ -20746,7 +20827,18 @@ var serviceContext = (function () {
}
addVm (vm) {
this.vms[vm._$id] = vm;
const id = vm._$id;
const oldVm = this.vms[id];
if (oldVm) {
const newId = generateId(oldVm, oldVm.$parent, VD_SYNC_VERSION);
oldVm._$id = newId;
this.vms[newId] = oldVm;
this.elements.forEach(element => {
const cid = element.cid;
element.cid = cid === id ? newId : cid;
});
}
this.vms[id] = vm;
}
removeVm (vm) {
...
...
@@ -20859,26 +20951,6 @@ var serviceContext = (function () {
}
}
function generateId (vm, parent, version) {
if (!vm.$parent) {
return '-1'
}
const vnode = vm.$vnode;
const context = vnode.context;
let id = vnode.data.attrs._i;
if (version && hasOwn(vnode.data, 'key')) { // 补充 key 值
id = id + ';' + vnode.data.key;
}
// slot 内的组件,需要补充 context 的 id,否则可能与内部组件索引值一致,导致 id 冲突
if (context && context !== parent && context._$id) {
if (process.env.NODE_ENV !== 'production') {
console.log('generateId:' + context._$id + ';' + parent._$id + ',' + id);
}
return context._$id + ';' + parent._$id + ',' + id
}
return parent._$id + ',' + id
}
function setResult (data, k, v) {
data[k] = v;
}
...
...
@@ -21013,10 +21085,6 @@ var serviceContext = (function () {
return clazz
}
function isNotSafeString (value) {
return value === 'null' || value === 'true' || value === 'false' || !isNaN(Number(value)) || (value.startsWith('[') && value.endsWith(']')) || (value.startsWith('{') && value.endsWith('}'))
}
function setData (id, name, value) {
switch (name) {
case B_CLASS:
...
...
@@ -21036,12 +21104,6 @@ var serviceContext = (function () {
case V_FOR:
return setForData.call(this, id, value)
}
// TODO 暂时先传递 dataset 至 view 层(理论上不需要)
if (name.indexOf('a-data-') === 0 && (typeof value !== 'string' || isNotSafeString(value))) {
try {
value = JSON.stringify(value);
} catch (e) {}
}
return ((this._$newData[id] || (this._$newData[id] = {}))[name] = value)
}
...
...
@@ -21080,7 +21142,10 @@ var serviceContext = (function () {
if (!hasOwn(value, 'keyIndex')) {
vForData[forIndex] = key;
} else {
(vForData[forIndex] || (vForData[forIndex] = {}))['k' + value.keyIndex] = key;
if (typeof vForData[forIndex] !== 'object') {
vForData[forIndex] = {};
}
vForData[forIndex]['k' + value.keyIndex] = key;
}
return key
}
...
...
@@ -21092,12 +21157,13 @@ var serviceContext = (function () {
'onLaunch',
'onShow',
'onHide',
'onUniNViewMessage',
'onPageNotFound',
'onUniNViewMessage',
'onPageNotFound',
'onThemeChange',
'onError',
'onError',
'onUnhandledRejection',
// Page
'onInit',
'onLoad',
// 'onShow',
'onReady',
...
...
@@ -21105,8 +21171,8 @@ var serviceContext = (function () {
'onUnload',
'onPullDownRefresh',
'onReachBottom',
'onTabItemTap',
'onAddToFavorites',
'onTabItemTap',
'onAddToFavorites',
'onShareTimeline',
'onShareAppMessage',
'onResize',
...
...
@@ -21349,6 +21415,7 @@ var serviceContext = (function () {
UniServiceJSBridge.publishHandler = publishHandler;
UniServiceJSBridge.invokeCallbackHandler = invokeCallbackHandler;
UniServiceJSBridge.removeCallbackHandler = removeCallbackHandler;
var index$1 = {
__vuePlugin: vuePlugin,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录