Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
65c374f2
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
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,发现更多精彩内容 >>
提交
65c374f2
编写于
9月 08, 2021
作者:
Y
Yaob1990
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(mp-alipay): 支付宝小程序全局分享设置
上级
37daefd6
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
3063 addition
and
3060 deletion
+3063
-3060
packages/uni-mp-alipay/dist/index.js
packages/uni-mp-alipay/dist/index.js
+2873
-2874
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
+190
-186
未找到文件。
packages/uni-mp-alipay/dist/index.js
浏览文件 @
65c374f2
此差异已折叠。
点击以展开。
src/platforms/mp-weixin/runtime/wrapper/app-base-parser.js
浏览文件 @
65c374f2
import
Vue
from
'
vue
'
import
Vue
from
'
vue
'
import
{
import
{
initHooks
,
initHooks
,
initMocks
initMocks
}
from
'
uni-wrapper/util
'
}
from
'
uni-wrapper/util
'
import
EventChannel
from
'
uni-helpers/EventChannel
'
import
EventChannel
from
'
uni-helpers/EventChannel
'
import
{
import
{
getEventChannel
getEventChannel
}
from
'
uni-helpers/navigate-to
'
}
from
'
uni-helpers/navigate-to
'
import
{
import
{
uniIdMixin
uniIdMixin
}
from
'
uni-shared
'
}
from
'
uni-shared
'
const
hooks
=
[
const
hooks
=
[
'
onShow
'
,
'
onShow
'
,
'
onHide
'
,
'
onHide
'
,
'
onError
'
,
'
onError
'
,
'
onPageNotFound
'
,
'
onPageNotFound
'
,
'
onThemeChange
'
,
'
onThemeChange
'
,
'
onUnhandledRejection
'
'
onUnhandledRejection
'
]
]
function
initEventChannel
()
{
if
(
__PLATFORM__
===
'
mp-alipay
'
)
{
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
hooks
.
push
(
'
onShareAppMessage
'
)
// 微信小程序使用自身getOpenerEventChannel
}
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
return
this
.
$scope
.
getOpenerEventChannel
()
function
initEventChannel
()
{
}
Vue
.
prototype
.
getOpenerEventChannel
=
function
()
{
if
(
!
this
.
__eventChannel__
)
{
// 微信小程序使用自身getOpenerEventChannel
this
.
__eventChannel__
=
new
EventChannel
()
if
(
__PLATFORM__
===
'
mp-weixin
'
)
{
}
return
this
.
$scope
.
getOpenerEventChannel
()
return
this
.
__eventChannel__
}
}
if
(
!
this
.
__eventChannel__
)
{
const
callHook
=
Vue
.
prototype
.
__call_hook
this
.
__eventChannel__
=
new
EventChannel
()
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
}
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
return
this
.
__eventChannel__
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
)
}
delete
args
.
__id__
const
callHook
=
Vue
.
prototype
.
__call_hook
}
Vue
.
prototype
.
__call_hook
=
function
(
hook
,
args
)
{
return
callHook
.
call
(
this
,
hook
,
args
)
if
(
hook
===
'
onLoad
'
&&
args
&&
args
.
__id__
)
{
}
this
.
__eventChannel__
=
getEventChannel
(
args
.
__id__
)
}
delete
args
.
__id__
}
function
initScopedSlotsParams
()
{
return
callHook
.
call
(
this
,
hook
,
args
)
const
center
=
{}
}
const
parents
=
{}
}
Vue
.
prototype
.
$hasScopedSlotsParams
=
function
(
vueId
)
{
function
initScopedSlotsParams
()
{
const
has
=
center
[
vueId
]
const
center
=
{}
if
(
!
has
)
{
const
parents
=
{}
parents
[
vueId
]
=
this
this
.
$on
(
'
hook:destory
'
,
()
=>
{
Vue
.
prototype
.
$hasScopedSlotsParams
=
function
(
vueId
)
{
delete
parents
[
vueId
]
const
has
=
center
[
vueId
]
})
if
(
!
has
)
{
}
parents
[
vueId
]
=
this
return
has
this
.
$on
(
'
hook:destory
'
,
()
=>
{
}
delete
parents
[
vueId
]
})
Vue
.
prototype
.
$getScopedSlotsParams
=
function
(
vueId
,
name
,
key
)
{
}
const
data
=
center
[
vueId
]
return
has
if
(
data
)
{
}
const
object
=
data
[
name
]
||
{}
return
key
?
object
[
key
]
:
object
Vue
.
prototype
.
$getScopedSlotsParams
=
function
(
vueId
,
name
,
key
)
{
}
else
{
const
data
=
center
[
vueId
]
parents
[
vueId
]
=
this
if
(
data
)
{
this
.
$on
(
'
hook:destory
'
,
()
=>
{
const
object
=
data
[
name
]
||
{}
delete
parents
[
vueId
]
return
key
?
object
[
key
]
:
object
})
}
else
{
}
parents
[
vueId
]
=
this
}
this
.
$on
(
'
hook:destory
'
,
()
=>
{
delete
parents
[
vueId
]
Vue
.
prototype
.
$setScopedSlotsParams
=
function
(
name
,
value
)
{
})
const
vueIds
=
this
.
$options
.
propsData
.
vueId
}
if
(
vueIds
)
{
}
const
vueId
=
vueIds
.
split
(
'
,
'
)[
0
]
const
object
=
center
[
vueId
]
=
center
[
vueId
]
||
{}
Vue
.
prototype
.
$setScopedSlotsParams
=
function
(
name
,
value
)
{
object
[
name
]
=
value
const
vueIds
=
this
.
$options
.
propsData
.
vueId
if
(
parents
[
vueId
])
{
if
(
vueIds
)
{
parents
[
vueId
].
$forceUpdate
()
const
vueId
=
vueIds
.
split
(
'
,
'
)[
0
]
}
const
object
=
center
[
vueId
]
=
center
[
vueId
]
||
{}
}
object
[
name
]
=
value
}
if
(
parents
[
vueId
])
{
parents
[
vueId
].
$forceUpdate
()
Vue
.
mixin
({
}
destroyed
()
{
}
const
propsData
=
this
.
$options
.
propsData
}
const
vueId
=
propsData
&&
propsData
.
vueId
if
(
vueId
)
{
Vue
.
mixin
({
delete
center
[
vueId
]
destroyed
()
{
delete
parents
[
vueId
]
const
propsData
=
this
.
$options
.
propsData
}
const
vueId
=
propsData
&&
propsData
.
vueId
}
if
(
vueId
)
{
})
delete
center
[
vueId
]
}
delete
parents
[
vueId
]
}
export
default
function
parseBaseApp
(
vm
,
{
}
mocks
,
})
initRefs
}
})
{
initEventChannel
()
export
default
function
parseBaseApp
(
vm
,
{
if
(
__PLATFORM__
===
'
mp-weixin
'
||
__PLATFORM__
===
'
mp-qq
'
||
__PLATFORM__
===
'
mp-toutiao
'
||
__PLATFORM__
===
'
mp-kuaishou
'
||
__PLATFORM__
===
'
mp-alipay
'
||
__PLATFORM__
===
'
mp-baidu
'
)
{
mocks
,
initScopedSlotsParams
()
initRefs
}
})
{
if
(
vm
.
$options
.
store
)
{
initEventChannel
()
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
if
(
__PLATFORM__
===
'
mp-weixin
'
||
__PLATFORM__
===
'
mp-qq
'
||
__PLATFORM__
===
'
mp-toutiao
'
||
__PLATFORM__
===
'
mp-kuaishou
'
||
__PLATFORM__
===
'
mp-alipay
'
||
__PLATFORM__
===
'
mp-baidu
'
)
{
}
initScopedSlotsParams
()
uniIdMixin
(
Vue
)
}
if
(
vm
.
$options
.
store
)
{
Vue
.
prototype
.
mpHost
=
__PLATFORM__
Vue
.
prototype
.
$store
=
vm
.
$options
.
store
}
Vue
.
mixin
({
uniIdMixin
(
Vue
)
beforeCreate
()
{
if
(
!
this
.
$options
.
mpType
)
{
Vue
.
prototype
.
mpHost
=
__PLATFORM__
return
}
Vue
.
mixin
({
beforeCreate
()
{
this
.
mpType
=
this
.
$options
.
mpType
if
(
!
this
.
$options
.
mpType
)
{
return
this
.
$mp
=
{
}
data
:
{},
[
this
.
mpType
]:
this
.
$options
.
mpInstance
this
.
mpType
=
this
.
$options
.
mpType
}
this
.
$mp
=
{
this
.
$scope
=
this
.
$options
.
mpInstance
data
:
{},
[
this
.
mpType
]:
this
.
$options
.
mpInstance
delete
this
.
$options
.
mpType
}
delete
this
.
$options
.
mpInstance
if
(
this
.
mpType
===
'
page
'
&&
typeof
getApp
===
'
function
'
)
{
// hack vue-i18n
this
.
$scope
=
this
.
$options
.
mpInstance
const
app
=
getApp
()
if
(
app
.
$vm
&&
app
.
$vm
.
$i18n
)
{
delete
this
.
$options
.
mpType
this
.
_i18n
=
app
.
$vm
.
$i18n
delete
this
.
$options
.
mpInstance
}
if
(
this
.
mpType
===
'
page
'
&&
typeof
getApp
===
'
function
'
)
{
// hack vue-i18n
}
const
app
=
getApp
()
if
(
this
.
mpType
!==
'
app
'
)
{
if
(
app
.
$vm
&&
app
.
$vm
.
$i18n
)
{
initRefs
(
this
)
this
.
_i18n
=
app
.
$vm
.
$i18n
initMocks
(
this
,
mocks
)
}
}
}
}
if
(
this
.
mpType
!==
'
app
'
)
{
})
initRefs
(
this
)
initMocks
(
this
,
mocks
)
const
appOptions
=
{
}
onLaunch
(
args
)
{
}
if
(
this
.
$vm
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
})
return
}
const
appOptions
=
{
if
(
__PLATFORM__
===
'
mp-weixin
'
||
__PLATFORM__
===
'
mp-qq
'
)
{
onLaunch
(
args
)
{
if
(
wx
.
canIUse
&&
!
wx
.
canIUse
(
'
nextTick
'
))
{
// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
if
(
this
.
$vm
)
{
// 已经初始化过了,主要是为了百度,百度 onShow 在 onLaunch 之前
console
.
error
(
'
当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上
'
)
return
}
}
}
if
(
__PLATFORM__
===
'
mp-weixin
'
||
__PLATFORM__
===
'
mp-qq
'
)
{
if
(
wx
.
canIUse
&&
!
wx
.
canIUse
(
'
nextTick
'
))
{
// 事实 上2.2.3 即可,简单使用 2.3.0 的 nextTick 判断
this
.
$vm
=
vm
console
.
error
(
'
当前微信基础库版本过低,请将 微信开发者工具-详情-项目设置-调试基础库版本 更换为`2.3.0`以上
'
)
}
this
.
$vm
.
$mp
=
{
}
app
:
this
}
this
.
$vm
=
vm
this
.
$vm
.
$scope
=
this
this
.
$vm
.
$mp
=
{
// vm 上也挂载 globalData
app
:
this
this
.
$vm
.
globalData
=
this
.
globalData
}
this
.
$vm
.
_isMounted
=
true
this
.
$vm
.
$scope
=
this
this
.
$vm
.
__call_hook
(
'
mounted
'
,
args
)
// vm 上也挂载 globalData
this
.
$vm
.
globalData
=
this
.
globalData
this
.
$vm
.
__call_hook
(
'
onLaunch
'
,
args
)
}
this
.
$vm
.
_isMounted
=
true
}
this
.
$vm
.
__call_hook
(
'
mounted
'
,
args
)
// 兼容旧版本 globalData
this
.
$vm
.
__call_hook
(
'
onLaunch
'
,
args
)
appOptions
.
globalData
=
vm
.
$options
.
globalData
||
{}
}
// 将 methods 中的方法挂在 getApp() 中
}
const
methods
=
vm
.
$options
.
methods
if
(
methods
)
{
// 兼容旧版本 globalData
Object
.
keys
(
methods
).
forEach
(
name
=>
{
appOptions
.
globalData
=
vm
.
$options
.
globalData
||
{}
appOptions
[
name
]
=
methods
[
name
]
// 将 methods 中的方法挂在 getApp() 中
})
const
methods
=
vm
.
$options
.
methods
}
if
(
methods
)
{
Object
.
keys
(
methods
).
forEach
(
name
=>
{
initHooks
(
appOptions
,
hooks
)
appOptions
[
name
]
=
methods
[
name
]
})
return
appOptions
}
}
initHooks
(
appOptions
,
hooks
)
return
appOptions
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录