Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
fe005f7e
U
uni-app
项目概览
DCloud
/
uni-app
2 个月 前同步成功
通知
717
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fe005f7e
编写于
12月 24, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(app): createSelectorQuery.in support ComponentInternalInstance (#3105)
上级
53d3c1b7
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
89 addition
and
18 deletion
+89
-18
packages/uni-api/src/index.ts
packages/uni-api/src/index.ts
+0
-1
packages/uni-api/src/service/ui/createIntersectionObserver.ts
...ages/uni-api/src/service/ui/createIntersectionObserver.ts
+2
-0
packages/uni-api/src/service/ui/createMediaQueryObserver.ts
packages/uni-api/src/service/ui/createMediaQueryObserver.ts
+2
-0
packages/uni-api/src/service/ui/createSelectorQuery.ts
packages/uni-api/src/service/ui/createSelectorQuery.ts
+7
-5
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+14
-2
packages/uni-core/src/helpers/page.ts
packages/uni-core/src/helpers/page.ts
+14
-3
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+7
-3
packages/uni-shared/dist/uni-shared.cjs.js
packages/uni-shared/dist/uni-shared.cjs.js
+9
-0
packages/uni-shared/dist/uni-shared.d.ts
packages/uni-shared/dist/uni-shared.d.ts
+6
-2
packages/uni-shared/dist/uni-shared.es.js
packages/uni-shared/dist/uni-shared.es.js
+8
-1
packages/uni-shared/src/vue.ts
packages/uni-shared/src/vue.ts
+20
-1
未找到文件。
packages/uni-api/src/index.ts
浏览文件 @
fe005f7e
...
...
@@ -118,7 +118,6 @@ export {
export
{
handlePromise
}
from
'
./helpers/api/promise
'
export
{
invokeApi
,
wrapperReturnValue
}
from
'
./helpers/interceptor
'
export
{
requestComponentObserver
}
from
'
./helpers/requestComponentObserver
'
// types
export
{
DefineAsyncApiFn
}
from
'
./helpers/api
'
packages/uni-api/src/service/ui/createIntersectionObserver.ts
浏览文件 @
fe005f7e
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
extend
,
isFunction
}
from
'
@vue/shared
'
import
{
resolveComponentInstance
}
from
'
@dcloudio/uni-shared
'
import
{
getCurrentPageVm
,
getPageIdByVm
}
from
'
@dcloudio/uni-core
'
import
{
addIntersectionObserver
,
...
...
@@ -96,6 +97,7 @@ class ServiceIntersectionObserver {
export
const
createIntersectionObserver
=
defineSyncApi
<
typeof
uni
.
createIntersectionObserver
>
(
'
createIntersectionObserver
'
,
(
context
?,
options
?)
=>
{
context
=
resolveComponentInstance
(
context
)
if
(
context
&&
!
getPageIdByVm
(
context
))
{
options
=
context
context
=
null
...
...
packages/uni-api/src/service/ui/createMediaQueryObserver.ts
浏览文件 @
fe005f7e
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
isFunction
}
from
'
@vue/shared
'
import
{
resolveComponentInstance
}
from
'
@dcloudio/uni-shared
'
import
{
getCurrentPageVm
,
getPageIdByVm
}
from
'
@dcloudio/uni-core
'
import
{
defineSyncApi
}
from
'
../../helpers/api
'
import
{
...
...
@@ -65,6 +66,7 @@ class ServiceMediaQueryObserver {
export
const
createMediaQueryObserver
=
defineSyncApi
<
typeof
uni
.
createMediaQueryObserver
>
(
'
createMediaQueryObserver
'
,
(
context
?:
any
)
=>
{
context
=
resolveComponentInstance
(
context
)
if
(
context
&&
!
getPageIdByVm
(
context
))
{
context
=
null
}
...
...
packages/uni-api/src/service/ui/createSelectorQuery.ts
浏览文件 @
fe005f7e
import
{
ComponentPublicInstance
}
from
'
vue
'
import
{
ComponentInternalInstance
,
ComponentPublicInstance
}
from
'
vue
'
import
{
resolveComponentInstance
}
from
'
@dcloudio/uni-shared
'
import
{
getCurrentPageVm
,
getPageIdByVm
}
from
'
@dcloudio/uni-core
'
import
{
requestComponentInfo
}
from
'
@dcloudio/uni-platform
'
import
{
getContextInfo
}
from
'
@dcloudio/uni-components
'
import
{
defineSyncApi
}
from
'
../../helpers/api
'
import
{
CanvasContext
}
from
'
../context/canvas
'
import
{
EditorContext
}
from
'
../context/editor
'
import
{
MapContext
}
from
'
../context/createMapContext
'
import
{
VideoContext
}
from
'
../context/createVideoContext
'
import
{
requestComponentInfo
}
from
'
@dcloudio/uni-platform
'
import
{
getContextInfo
}
from
'
@dcloudio/uni-components
'
type
NodeField
=
UniApp
.
NodeField
export
interface
SelectorQueryNodeInfo
...
...
@@ -153,8 +154,8 @@ class SelectorQuery implements UniApp.SelectorQuery {
return
this
.
_nodesRef
as
NodesRef
}
in
(
component
?:
ComponentPublicInstance
)
{
this
.
_component
=
component
||
undefined
in
(
component
?:
ComponentPublicInstance
|
ComponentInternalInstance
)
{
this
.
_component
=
resolveComponentInstance
(
component
)
return
this
}
...
...
@@ -199,6 +200,7 @@ class SelectorQuery implements UniApp.SelectorQuery {
export
const
createSelectorQuery
=
<
typeof
uni
.
createSelectorQuery
>
(
defineSyncApi
(
'
createSelectorQuery
'
,
(
context
?:
any
)
=>
{
context
=
resolveComponentInstance
(
context
)
if
(
context
&&
!
getPageIdByVm
(
context
))
{
context
=
null
}
...
...
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
fe005f7e
...
...
@@ -194,6 +194,14 @@ var serviceContext = (function (vue) {
const ON_APP_ENTER_BACKGROUND = 'onAppEnterBackground';
const ON_WXS_INVOKE_CALL_METHOD = 'onWxsInvokeCallMethod';
function isComponentInternalInstance(vm) {
return !!vm.appContext;
}
function resolveComponentInstance(instance) {
return (instance &&
(isComponentInternalInstance(instance) ? instance.proxy : instance));
}
let lastLogTime = 0;
function formatLog(module, ...args) {
const now = Date.now();
...
...
@@ -2066,7 +2074,8 @@ var serviceContext = (function (vue) {
});
}
function getPageIdByVm(vm) {
function getPageIdByVm(instance) {
const vm = resolveComponentInstance(instance);
if (vm.$page) {
return vm.$page.id;
}
...
...
@@ -11007,6 +11016,7 @@ var serviceContext = (function (vue) {
}
}
const createIntersectionObserver = defineSyncApi('createIntersectionObserver', (context, options) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
options = context;
context = null;
...
...
@@ -11044,6 +11054,7 @@ var serviceContext = (function (vue) {
}
}
const createMediaQueryObserver = defineSyncApi('createMediaQueryObserver', (context) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
context = null;
}
...
...
@@ -11207,7 +11218,7 @@ var serviceContext = (function (vue) {
return this._nodesRef;
}
in(component) {
this._component =
component || undefined
;
this._component =
resolveComponentInstance(component)
;
return this;
}
select(selector) {
...
...
@@ -11230,6 +11241,7 @@ var serviceContext = (function (vue) {
}
}
const createSelectorQuery = (defineSyncApi('createSelectorQuery', (context) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
context = null;
}
...
...
packages/uni-core/src/helpers/page.ts
浏览文件 @
fe005f7e
import
{
addLeadingSlash
,
EventChannel
}
from
'
@dcloudio/uni-shared
'
import
{
addLeadingSlash
,
EventChannel
,
resolveComponentInstance
,
}
from
'
@dcloudio/uni-shared
'
import
{
extend
}
from
'
@vue/shared
'
import
{
ComponentPublicInstance
,
getCurrentInstance
}
from
'
vue
'
import
{
ComponentInternalInstance
,
ComponentPublicInstance
,
getCurrentInstance
,
}
from
'
vue
'
import
{
rpx2px
}
from
'
./util
'
export
function
useCurrentPageId
()
{
...
...
@@ -11,7 +19,10 @@ export function useCurrentPageId() {
return
getCurrentInstance
()
!
.
root
.
proxy
!
.
$page
.
id
}
export
function
getPageIdByVm
(
vm
:
ComponentPublicInstance
)
{
export
function
getPageIdByVm
(
instance
:
ComponentPublicInstance
|
ComponentInternalInstance
)
{
const
vm
=
resolveComponentInstance
(
instance
)
!
if
(
vm
.
$page
)
{
return
vm
.
$page
.
id
}
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
fe005f7e
import { withModifiers, createVNode, getCurrentInstance, ref, defineComponent, openBlock, createElementBlock, provide, computed, watch, onUnmounted, inject, onBeforeUnmount, mergeProps, injectHook, reactive, onActivated, onMounted, nextTick, onBeforeMount, withDirectives, vShow, shallowRef, watchEffect, isVNode, Fragment, markRaw, createTextVNode, onBeforeActivate, onBeforeDeactivate, createBlock, renderList, onDeactivated, createApp, Transition, effectScope, withCtx, KeepAlive, resolveDynamicComponent, createElementVNode, normalizeStyle, renderSlot } from "vue";
import { isString, extend, stringifyStyle, parseStringStyle, isPlainObject, isFunction, capitalize, camelize, isArray, hasOwn, isObject, toRawType, makeMap as makeMap$1, isPromise, hyphenate, invokeArrayFns as invokeArrayFns$1 } from "@vue/shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, passive, initCustomDataset, addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { once, UNI_STORAGE_LOCALE, I18N_JSON_DELIMITERS, passive, initCustomDataset,
resolveComponentInstance,
addLeadingSlash, invokeArrayFns, resolveOwnerVm, resolveOwnerEl, ON_WXS_INVOKE_CALL_METHOD, normalizeTarget, ON_RESIZE, ON_APP_ENTER_FOREGROUND, ON_APP_ENTER_BACKGROUND, ON_SHOW, ON_HIDE, ON_PAGE_SCROLL, ON_REACH_BOTTOM, EventChannel, SCHEME_RE, DATA_RE, getCustomDataset, LINEFEED, ON_ERROR, callOptions, ON_LAUNCH, PRIMARY_COLOR, removeLeadingSlash, getLen, debounce, ON_LOAD, UniLifecycleHooks, NAVBAR_HEIGHT, parseQuery, ON_UNLOAD, ON_REACH_BOTTOM_DISTANCE, decodedQuery, WEB_INVOKE_APPSERVICE, ON_WEB_INVOKE_APP_SERVICE, updateElementStyle, ON_BACK_PRESS, parseUrl, addFont, scrollTo, RESPONSIVE_MIN_WIDTH, formatDateTime, ON_NAVIGATION_BAR_BUTTON_TAP, ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED, ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED, ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED, ON_PULL_DOWN_REFRESH } from "@dcloudio/uni-shared";
import { initVueI18n, isI18nStr, LOCALE_EN, LOCALE_ES, LOCALE_FR, LOCALE_ZH_HANS, LOCALE_ZH_HANT } from "@dcloudio/uni-i18n";
import { useRoute, createRouter, createWebHistory, createWebHashHistory, useRouter, isNavigationFailure, RouterView } from "vue-router";
const isEnableLocale = once(() => typeof __uniConfig !== "undefined" && __uniConfig.locales && !!Object.keys(__uniConfig.locales).length);
...
...
@@ -848,7 +848,8 @@ function createSvgIconVNode(path, color = "#000", size = 27) {
function useCurrentPageId() {
return getCurrentInstance().root.proxy.$page.id;
}
function getPageIdByVm(vm) {
function getPageIdByVm(instance2) {
const vm = resolveComponentInstance(instance2);
if (vm.$page) {
return vm.$page.id;
}
...
...
@@ -4092,6 +4093,7 @@ class ServiceIntersectionObserver {
}
}
const createIntersectionObserver = /* @__PURE__ */ defineSyncApi("createIntersectionObserver", (context, options) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
options = context;
context = null;
...
...
@@ -4127,6 +4129,7 @@ class ServiceMediaQueryObserver {
}
}
const createMediaQueryObserver = /* @__PURE__ */ defineSyncApi("createMediaQueryObserver", (context) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
context = null;
}
...
...
@@ -4283,7 +4286,7 @@ class SelectorQuery {
return this._nodesRef;
}
in(component) {
this._component =
component || void 0
;
this._component =
resolveComponentInstance(component)
;
return this;
}
select(selector) {
...
...
@@ -4306,6 +4309,7 @@ class SelectorQuery {
}
}
const createSelectorQuery = /* @__PURE__ */ defineSyncApi("createSelectorQuery", (context) => {
context = resolveComponentInstance(context);
if (context && !getPageIdByVm(context)) {
context = null;
}
...
...
packages/uni-shared/dist/uni-shared.cjs.js
浏览文件 @
fe005f7e
...
...
@@ -160,6 +160,13 @@ const ON_APP_ENTER_BACKGROUND = 'onAppEnterBackground';
const
ON_WEB_INVOKE_APP_SERVICE
=
'
onWebInvokeAppService
'
;
const
ON_WXS_INVOKE_CALL_METHOD
=
'
onWxsInvokeCallMethod
'
;
function
isComponentInternalInstance
(
vm
)
{
return
!!
vm
.
appContext
;
}
function
resolveComponentInstance
(
instance
)
{
return
(
instance
&&
(
isComponentInternalInstance
(
instance
)
?
instance
.
proxy
:
instance
));
}
function
resolveOwnerVm
(
vm
)
{
if
(
!
vm
)
{
return
;
...
...
@@ -1325,6 +1332,7 @@ exports.initCustomDataset = initCustomDataset;
exports
.
invokeArrayFns
=
invokeArrayFns
;
exports
.
isAppNativeTag
=
isAppNativeTag
;
exports
.
isBuiltInComponent
=
isBuiltInComponent
;
exports
.
isComponentInternalInstance
=
isComponentInternalInstance
;
exports
.
isComponentTag
=
isComponentTag
;
exports
.
isH5CustomElement
=
isH5CustomElement
;
exports
.
isH5NativeTag
=
isH5NativeTag
;
...
...
@@ -1340,6 +1348,7 @@ exports.parseUrl = parseUrl;
exports
.
passive
=
passive
;
exports
.
plusReady
=
plusReady
;
exports
.
removeLeadingSlash
=
removeLeadingSlash
;
exports
.
resolveComponentInstance
=
resolveComponentInstance
;
exports
.
resolveOwnerEl
=
resolveOwnerEl
;
exports
.
resolveOwnerVm
=
resolveOwnerVm
;
exports
.
sanitise
=
sanitise
;
...
...
packages/uni-shared/dist/uni-shared.d.ts
浏览文件 @
fe005f7e
import
type
{
ComponentInternalInstance
}
from
'
@vue/runtime-core
'
;
import
{
ComponentOptionsBase
}
from
'
@vue/runtime-core
'
;
import
{
ComponentPublicInstance
}
from
'
@vue/runtime-core
'
;
import
type
{
ComponentPublicInstance
}
from
'
@vue/runtime-core
'
;
import
{
ComponentPublicInstance
as
ComponentPublicInstance_2
}
from
'
vue
'
;
import
{
createApp
}
from
'
vue
'
;
import
{
RendererNode
}
from
'
@vue/runtime-core
'
;
...
...
@@ -224,6 +224,8 @@ export declare function isAppNativeTag(tag: string): boolean;
export
declare
function
isBuiltInComponent
(
tag
:
string
):
boolean
;
export
declare
function
isComponentInternalInstance
(
vm
:
unknown
):
vm
is
ComponentInternalInstance
;
export
declare
function
isComponentTag
(
tag
:
string
):
boolean
;
export
declare
function
isH5CustomElement
(
tag
:
string
):
boolean
;
...
...
@@ -538,9 +540,11 @@ export declare function removeLeadingSlash(str: string): string;
export
declare
const
RENDERJS_MODULES
=
"
renderjsModules
"
;
export
declare
function
resolveComponentInstance
(
instance
?:
ComponentInternalInstance
|
ComponentPublicInstance
):
ComponentPublicInstance
<
{},
{},
{},
{},
{},
{},
{},
{},
false
,
ComponentOptionsBase
<
any
,
any
,
any
,
any
,
any
,
any
,
any
,
any
,
any
,
{}
>>
|
undefined
;
export
declare
function
resolveOwnerEl
(
instance
:
ComponentInternalInstance
):
RendererNode
|
null
;
export
declare
function
resolveOwnerVm
(
vm
:
ComponentInternalInstance
):
ComponentPublicInstance
<
{},
{},
{},
{},
{},
{},
{},
{},
false
,
ComponentOptionsBase
<
any
,
any
,
any
,
any
,
any
,
any
,
any
,
any
,
any
,
{}
>>
|
undefined
;
export
declare
function
resolveOwnerVm
(
vm
:
ComponentInternalInstance
):
ComponentPublicInstance
<
{},
{},
{},
{},
{},
{},
{},
{},
false
,
ComponentOptionsBase
<
any
,
any
,
any
,
any
,
any
,
any
,
any
,
any
,
any
,
{}
>>
|
undefined
;
export
declare
const
RESPONSIVE_MIN_WIDTH
=
768
;
...
...
packages/uni-shared/dist/uni-shared.es.js
浏览文件 @
fe005f7e
...
...
@@ -156,6 +156,13 @@ const ON_APP_ENTER_BACKGROUND = 'onAppEnterBackground';
const
ON_WEB_INVOKE_APP_SERVICE
=
'
onWebInvokeAppService
'
;
const
ON_WXS_INVOKE_CALL_METHOD
=
'
onWxsInvokeCallMethod
'
;
function
isComponentInternalInstance
(
vm
)
{
return
!!
vm
.
appContext
;
}
function
resolveComponentInstance
(
instance
)
{
return
(
instance
&&
(
isComponentInternalInstance
(
instance
)
?
instance
.
proxy
:
instance
));
}
function
resolveOwnerVm
(
vm
)
{
if
(
!
vm
)
{
return
;
...
...
@@ -1198,4 +1205,4 @@ function getEnvLocale() {
return
(
lang
&&
lang
.
replace
(
/
[
.:
]
.*/
,
''
))
||
'
en
'
;
}
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
BUILT_IN_TAG_NAMES
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVueTextNode
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UNI_STORAGE_LOCALE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatH5Log
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
,
invokeArrayFns
,
isAppNativeTag
,
isBuiltInComponent
,
isComponent
Tag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
export
{
ACTION_TYPE_ADD_EVENT
,
ACTION_TYPE_ADD_WXS_EVENT
,
ACTION_TYPE_CREATE
,
ACTION_TYPE_EVENT
,
ACTION_TYPE_INSERT
,
ACTION_TYPE_PAGE_CREATE
,
ACTION_TYPE_PAGE_CREATED
,
ACTION_TYPE_PAGE_SCROLL
,
ACTION_TYPE_REMOVE
,
ACTION_TYPE_REMOVE_ATTRIBUTE
,
ACTION_TYPE_REMOVE_EVENT
,
ACTION_TYPE_SET_ATTRIBUTE
,
ACTION_TYPE_SET_TEXT
,
ATTR_CHANGE_PREFIX
,
ATTR_CLASS
,
ATTR_INNER_HTML
,
ATTR_STYLE
,
ATTR_TEXT_CONTENT
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
ATTR_V_SHOW
,
BACKGROUND_COLOR
,
BUILT_IN_TAGS
,
BUILT_IN_TAG_NAMES
,
COMPONENT_NAME_PREFIX
,
COMPONENT_PREFIX
,
COMPONENT_SELECTOR_PREFIX
,
DATA_RE
,
EventChannel
,
EventModifierFlags
,
I18N_JSON_DELIMITERS
,
JSON_PROTOCOL
,
LINEFEED
,
NAVBAR_HEIGHT
,
NODE_TYPE_COMMENT
,
NODE_TYPE_ELEMENT
,
NODE_TYPE_PAGE
,
NODE_TYPE_TEXT
,
NVueTextNode
,
ON_ADD_TO_FAVORITES
,
ON_APP_ENTER_BACKGROUND
,
ON_APP_ENTER_FOREGROUND
,
ON_BACK_PRESS
,
ON_ERROR
,
ON_HIDE
,
ON_KEYBOARD_HEIGHT_CHANGE
,
ON_LAUNCH
,
ON_LOAD
,
ON_NAVIGATION_BAR_BUTTON_TAP
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CHANGED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CLICKED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_CONFIRMED
,
ON_NAVIGATION_BAR_SEARCH_INPUT_FOCUS_CHANGED
,
ON_PAGE_NOT_FOUND
,
ON_PAGE_SCROLL
,
ON_PULL_DOWN_REFRESH
,
ON_REACH_BOTTOM
,
ON_REACH_BOTTOM_DISTANCE
,
ON_READY
,
ON_RESIZE
,
ON_SHARE_APP_MESSAGE
,
ON_SHARE_TIMELINE
,
ON_SHOW
,
ON_TAB_ITEM_TAP
,
ON_THEME_CHANGE
,
ON_UNHANDLE_REJECTION
,
ON_UNLOAD
,
ON_WEB_INVOKE_APP_SERVICE
,
ON_WXS_INVOKE_CALL_METHOD
,
PLUS_RE
,
PRIMARY_COLOR
,
RENDERJS_MODULES
,
RESPONSIVE_MIN_WIDTH
,
SCHEME_RE
,
SELECTED_COLOR
,
SLOT_DEFAULT_NAME
,
TABBAR_HEIGHT
,
TAGS
,
UNI_SSR
,
UNI_SSR_DATA
,
UNI_SSR_GLOBAL_DATA
,
UNI_SSR_STORE
,
UNI_SSR_TITLE
,
UNI_STORAGE_LOCALE
,
UniBaseNode
,
UniCommentNode
,
UniElement
,
UniEvent
,
UniInputElement
,
UniLifecycleHooks
,
UniNode
,
UniTextAreaElement
,
UniTextNode
,
WEB_INVOKE_APPSERVICE
,
WXS_MODULES
,
WXS_PROTOCOL
,
addFont
,
addLeadingSlash
,
cache
,
cacheStringFunction
,
callOptions
,
createIsCustomElement
,
createRpx2Unit
,
createUniEvent
,
debounce
,
decode
,
decodedQuery
,
defaultMiniProgramRpx2Unit
,
defaultRpx2Unit
,
dynamicSlotName
,
forcePatchProp
,
formatAppLog
,
formatDateTime
,
formatH5Log
,
formatLog
,
getCustomDataset
,
getEnvLocale
,
getLen
,
getValueByDataPath
,
initCustomDataset
,
invokeArrayFns
,
isAppNativeTag
,
isBuiltInComponent
,
isComponent
InternalInstance
,
isComponentTag
,
isH5CustomElement
,
isH5NativeTag
,
isMiniProgramNativeTag
,
isRootHook
,
normalizeDataset
,
normalizeEventType
,
normalizeTarget
,
once
,
parseEventName
,
parseQuery
,
parseUrl
,
passive
,
plusReady
,
removeLeadingSlash
,
resolveComponentInstance
,
resolveOwnerEl
,
resolveOwnerVm
,
sanitise
,
scrollTo
,
stringifyQuery
,
updateElementStyle
};
packages/uni-shared/src/vue.ts
浏览文件 @
fe005f7e
import
type
{
ComponentInternalInstance
,
VNode
}
from
'
@vue/runtime-core
'
import
type
{
ComponentInternalInstance
,
ComponentPublicInstance
,
VNode
,
}
from
'
@vue/runtime-core
'
import
{
hyphenate
}
from
'
@vue/shared
'
import
{
isBuiltInComponent
}
from
'
./tags
'
import
{
SLOT_DEFAULT_NAME
}
from
'
./constants
'
export
function
isComponentInternalInstance
(
vm
:
unknown
):
vm
is
ComponentInternalInstance
{
return
!!
(
vm
as
ComponentInternalInstance
).
appContext
}
export
function
resolveComponentInstance
(
instance
?:
ComponentInternalInstance
|
ComponentPublicInstance
)
{
return
(
instance
&&
(
isComponentInternalInstance
(
instance
)
?
instance
.
proxy
!
:
instance
)
)
}
export
function
resolveOwnerVm
(
vm
:
ComponentInternalInstance
)
{
if
(
!
vm
)
{
return
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录