Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
c838528e
U
uni-app
项目概览
MuGuiLin
/
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,发现更多精彩内容 >>
提交
c838528e
编写于
2月 09, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
差异文件
wip(app): nvue
上级
731f54d0
433ee547
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
50185 addition
and
52613 deletion
+50185
-52613
packages/uni-app-plus/build.json
packages/uni-app-plus/build.json
+22
-12
packages/uni-app-plus/dist/uni.runtime.esm.js
packages/uni-app-plus/dist/uni.runtime.esm.js
+18480
-19047
packages/uni-app-plus/dist/uni.vue.js
packages/uni-app-plus/dist/uni.vue.js
+269
-0
packages/uni-app-plus/src/service/vue.ts
packages/uni-app-plus/src/service/vue.ts
+1
-0
packages/uni-app-plus/vite.config.ts
packages/uni-app-plus/vite.config.ts
+0
-1
packages/uni-app-vue/build.json
packages/uni-app-vue/build.json
+8
-36
packages/uni-app-vue/dist/nvue.runtime.esm.dev.js
packages/uni-app-vue/dist/nvue.runtime.esm.dev.js
+8298
-8302
packages/uni-app-vue/dist/nvue.runtime.esm.prod.js
packages/uni-app-vue/dist/nvue.runtime.esm.prod.js
+6822
-6828
packages/uni-app-vue/dist/service.runtime.esm.dev.js
packages/uni-app-vue/dist/service.runtime.esm.dev.js
+8885
-9813
packages/uni-app-vue/dist/service.runtime.esm.prod.js
packages/uni-app-vue/dist/service.runtime.esm.prod.js
+7396
-8303
packages/uni-app-vue/lib/service.runtime.esm.js
packages/uni-app-vue/lib/service.runtime.esm.js
+3
-268
packages/uni-components/build.json
packages/uni-components/build.json
+0
-1
packages/uni-components/vite.config.ts
packages/uni-components/vite.config.ts
+0
-1
packages/uni-vue/src/componentOptions/index.ts
packages/uni-vue/src/componentOptions/index.ts
+1
-1
未找到文件。
packages/uni-app-plus/build.json
浏览文件 @
c838528e
...
...
@@ -13,19 +13,9 @@
"src/service/index.ts"
:
"dist/uni.runtime.esm.js"
},
"output"
:
{
"freeze"
:
false
,
"name"
:
"serviceContext"
,
"format"
:
"iife"
,
"banner"
:
"export function createServiceContext(weex, plus, instanceContext){
\n
const Vue = instanceContext.Vue;
\n
let setTimeout = instanceContext.setTimeout;
\n
let clearTimeout = instanceContext.clearTimeout;
\n
let setInterval = instanceContext.setInterval;
\n
let clearInterval = instanceContext.clearInterval;
\n
const __uniConfig = instanceContext.__uniConfig;
\n
const __uniRoutes = instanceContext.__uniRoutes;
\n
const VueShared = instanceContext.VueShared;
\n
"
,
"footer"
:
"const uni = serviceContext.uni;
\n
const getApp = serviceContext.getApp;
\n
const getCurrentPages = serviceContext.getCurrentPages;
\n
const UniServiceJSBridge = serviceContext.UniServiceJSBridge;
\n
return serviceContext;
\n
}"
,
"globals"
:
{
"vue"
:
"Vue"
,
"@vue/shared"
:
"VueShared"
},
"inlineDynamicImports"
:
true
"freeze"
:
false
},
"replacements"
:
{
"__NVUE__"
:
"false"
,
"__PLATFORM__"
:
"'app'"
,
"__APP_VIEW__"
:
"false"
,
"__VUE_OPTIONS_API__"
:
"true"
,
...
...
@@ -38,7 +28,7 @@
"__UNI_FEATURE_I18N_ZH_HANS__"
:
"true"
,
"__UNI_FEATURE_I18N_ZH_HANT__"
:
"true"
},
"external"
:
[
"vue"
,
"@vue/shared"
],
"external"
:
[
"vue"
,
"@vue/shared"
,
"@dcloudio/uni-shared"
],
"replaceAfterBundled"
:
{
"__VUE__"
:
"vue"
}
...
...
@@ -52,5 +42,25 @@
"format"
:
"umd"
},
"external"
:
false
},
{
"input"
:
{
"src/service/vue.ts"
:
"dist/uni.vue.js"
},
"output"
:
{},
"replacements"
:
{
"__PLATFORM__"
:
"'app'"
,
"__APP_VIEW__"
:
"false"
,
"__VUE_OPTIONS_API__"
:
"true"
,
"__VUE_PROD_DEVTOOLS__"
:
"false"
,
"__UNI_FEATURE_WX__"
:
"true"
,
"__UNI_FEATURE_PROMISE__"
:
"false"
,
"__UNI_FEATURE_I18N_EN__"
:
"true"
,
"__UNI_FEATURE_I18N_ES__"
:
"true"
,
"__UNI_FEATURE_I18N_FR__"
:
"true"
,
"__UNI_FEATURE_I18N_ZH_HANS__"
:
"true"
,
"__UNI_FEATURE_I18N_ZH_HANT__"
:
"true"
},
"external"
:
[
"@dcloudio/uni-shared"
,
"@vue/shared"
,
"vue"
]
}
]
packages/uni-app-plus/dist/uni.runtime.esm.js
浏览文件 @
c838528e
此差异已折叠。
点击以展开。
packages/uni-app-plus/dist/uni.vue.js
0 → 100644
浏览文件 @
c838528e
import
{
isString
,
isArray
,
isFunction
}
from
'
@vue/shared
'
;
import
{
invokeArrayFns
,
ON_LOAD
,
LINEFEED
,
ON_SHOW
,
RENDERJS_MODULES
,
WXS_PROTOCOL
,
formatLog
,
WXS_MODULES
,
UniLifecycleHooks
,
ON_ERROR
}
from
'
@dcloudio/uni-shared
'
;
import
{
nextTick
,
injectHook
}
from
'
vue
'
;
function
getCurrentPage
()
{
const
pages
=
getCurrentPages
();
const
len
=
pages
.
length
;
if
(
len
)
{
return
pages
[
len
-
1
];
}
}
function
getCurrentPageVm
()
{
const
page
=
getCurrentPage
();
if
(
page
)
{
return
page
.
$vm
;
}
}
function
invokeHook
(
vm
,
name
,
args
)
{
if
(
isString
(
vm
))
{
args
=
name
;
name
=
vm
;
vm
=
getCurrentPageVm
();
}
else
if
(
typeof
vm
===
'
number
'
)
{
const
page
=
getCurrentPages
().
find
((
page
)
=>
page
.
$page
.
id
===
vm
);
if
(
page
)
{
vm
=
page
.
$vm
;
}
else
{
vm
=
getCurrentPageVm
();
}
}
if
(
!
vm
)
{
return
;
}
// 兼容 nvue
{
if
(
vm
.
__call_hook
)
{
return
vm
.
__call_hook
(
name
,
args
);
}
}
const
hooks
=
vm
.
$
[
name
];
return
hooks
&&
invokeArrayFns
(
hooks
,
args
);
}
function
injectLifecycleHook
(
name
,
hook
,
publicThis
,
instance
)
{
if
(
isFunction
(
hook
))
{
injectHook
(
name
,
hook
.
bind
(
publicThis
),
instance
);
}
}
function
initHooks
(
options
,
instance
,
publicThis
)
{
const
mpType
=
options
.
mpType
||
publicThis
.
$mpType
;
// 为了组件也可以监听部分生命周期,故不再判断mpType,统一添加on开头的生命周期
Object
.
keys
(
options
).
forEach
((
name
)
=>
{
if
(
name
.
indexOf
(
'
on
'
)
===
0
)
{
const
hooks
=
options
[
name
];
if
(
isArray
(
hooks
))
{
hooks
.
forEach
((
hook
)
=>
injectLifecycleHook
(
name
,
hook
,
publicThis
,
instance
));
}
else
{
injectLifecycleHook
(
name
,
hooks
,
publicThis
,
instance
);
}
}
});
if
(
mpType
===
'
page
'
)
{
instance
.
__isVisible
=
true
;
try
{
invokeHook
(
publicThis
,
ON_LOAD
,
instance
.
attrs
.
__pageQuery
);
delete
instance
.
attrs
.
__pageQuery
;
}
catch
(
e
)
{
console
.
error
(
e
.
message
+
LINEFEED
+
e
.
stack
);
}
nextTick
(()
=>
{
// 延迟onShow,保证组件的onShow也可以监听到
invokeHook
(
publicThis
,
ON_SHOW
);
});
}
}
function
initRenderjs
(
options
,
instance
)
{
initModules
(
instance
,
options
.
$renderjs
,
options
[
'
$
'
+
RENDERJS_MODULES
]);
}
function
initModules
(
instance
,
modules
,
moduleIds
=
{})
{
if
(
!
isArray
(
modules
))
{
return
;
}
const
ownerId
=
instance
.
uid
;
// 在vue的定制内核中,通过$wxsModules来判断事件函数源码中是否包含该模块调用
// !$wxsModules.find(module => invokerSourceCode.indexOf('.' + module + '.') > -1)
const
$wxsModules
=
(
instance
.
$wxsModules
||
(
instance
.
$wxsModules
=
[]));
const
ctx
=
instance
.
ctx
;
modules
.
forEach
((
module
)
=>
{
if
(
moduleIds
[
module
])
{
ctx
[
module
]
=
proxyModule
(
ownerId
,
moduleIds
[
module
],
module
);
$wxsModules
.
push
(
module
);
}
else
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
console
.
error
(
formatLog
(
'
initModules
'
,
modules
,
moduleIds
));
}
}
});
}
function
proxyModule
(
ownerId
,
moduleId
,
module
)
{
const
target
=
{};
return
new
Proxy
(
target
,
{
get
(
_
,
p
)
{
return
(
target
[
p
]
||
(
target
[
p
]
=
createModuleFunction
(
ownerId
,
moduleId
,
module
,
p
)));
},
});
}
function
createModuleFunction
(
ownerId
,
moduleId
,
module
,
name
)
{
const
target
=
()
=>
{
};
const
toJSON
=
()
=>
WXS_PROTOCOL
+
JSON
.
stringify
([
ownerId
,
moduleId
,
module
+
'
.
'
+
name
]);
return
new
Proxy
(
target
,
{
get
(
_
,
p
)
{
if
(
p
===
'
toJSON
'
)
{
return
toJSON
;
}
return
(
target
[
p
]
||
(
target
[
p
]
=
createModuleFunction
(
ownerId
,
moduleId
,
module
+
'
.
'
+
name
,
p
)));
},
apply
(
_target
,
_thisArg
,
args
)
{
return
(
WXS_PROTOCOL
+
JSON
.
stringify
([
ownerId
,
moduleId
,
module
+
'
.
'
+
name
,
[...
args
]]));
},
});
}
function
initWxs
(
options
,
instance
)
{
initModules
(
instance
,
options
.
$wxs
,
options
[
'
$
'
+
WXS_MODULES
]);
}
function
applyOptions
(
options
,
instance
,
publicThis
)
{
{
initWxs
(
options
,
instance
);
initRenderjs
(
options
,
instance
);
}
initHooks
(
options
,
instance
,
publicThis
);
}
function
set
(
target
,
key
,
val
)
{
return
(
target
[
key
]
=
val
);
}
function
errorHandler
(
err
,
instance
,
info
)
{
if
(
!
instance
)
{
throw
err
;
}
const
app
=
getApp
();
if
(
!
app
||
!
app
.
$vm
)
{
throw
err
;
}
{
invokeHook
(
app
.
$vm
,
ON_ERROR
,
err
);
}
}
function
mergeAsArray
(
to
,
from
)
{
return
to
?
[...
new
Set
([].
concat
(
to
,
from
))]
:
from
;
}
function
initOptionMergeStrategies
(
optionMergeStrategies
)
{
UniLifecycleHooks
.
forEach
((
name
)
=>
{
optionMergeStrategies
[
name
]
=
mergeAsArray
;
});
}
let
realAtob
;
const
b64
=
'
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
'
;
const
b64re
=
/^
(?:[
A-Za-z
\d
+
/]{4})
*
?(?:[
A-Za-z
\d
+
/]{2}(?:
==
)?
|
[
A-Za-z
\d
+
/]{3}
=
?)?
$/
;
if
(
typeof
atob
!==
'
function
'
)
{
realAtob
=
function
(
str
)
{
str
=
String
(
str
).
replace
(
/
[\t\n\f\r
]
+/g
,
''
);
if
(
!
b64re
.
test
(
str
))
{
throw
new
Error
(
"
Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
"
);
}
// Adding the padding if missing, for semplicity
str
+=
'
==
'
.
slice
(
2
-
(
str
.
length
&
3
));
var
bitmap
;
var
result
=
''
;
var
r1
;
var
r2
;
var
i
=
0
;
for
(;
i
<
str
.
length
;)
{
bitmap
=
(
b64
.
indexOf
(
str
.
charAt
(
i
++
))
<<
18
)
|
(
b64
.
indexOf
(
str
.
charAt
(
i
++
))
<<
12
)
|
((
r1
=
b64
.
indexOf
(
str
.
charAt
(
i
++
)))
<<
6
)
|
(
r2
=
b64
.
indexOf
(
str
.
charAt
(
i
++
)));
result
+=
r1
===
64
?
String
.
fromCharCode
((
bitmap
>>
16
)
&
255
)
:
r2
===
64
?
String
.
fromCharCode
((
bitmap
>>
16
)
&
255
,
(
bitmap
>>
8
)
&
255
)
:
String
.
fromCharCode
((
bitmap
>>
16
)
&
255
,
(
bitmap
>>
8
)
&
255
,
bitmap
&
255
);
}
return
result
;
};
}
else
{
// 注意atob只能在全局对象上调用,例如:`const Base64 = {atob};Base64.atob('xxxx')`是错误的用法
realAtob
=
atob
;
}
function
b64DecodeUnicode
(
str
)
{
return
decodeURIComponent
(
realAtob
(
str
)
.
split
(
''
)
.
map
(
function
(
c
)
{
return
'
%
'
+
(
'
00
'
+
c
.
charCodeAt
(
0
).
toString
(
16
)).
slice
(
-
2
);
})
.
join
(
''
));
}
function
getCurrentUserInfo
()
{
const
token
=
uni
.
getStorageSync
(
'
uni_id_token
'
)
||
''
;
const
tokenArr
=
token
.
split
(
'
.
'
);
if
(
!
token
||
tokenArr
.
length
!==
3
)
{
return
{
uid
:
null
,
role
:
[],
permission
:
[],
tokenExpired
:
0
,
};
}
let
userInfo
;
try
{
userInfo
=
JSON
.
parse
(
b64DecodeUnicode
(
tokenArr
[
1
]));
}
catch
(
error
)
{
throw
new
Error
(
'
获取当前用户信息出错,详细错误信息为:
'
+
error
.
message
);
}
userInfo
.
tokenExpired
=
userInfo
.
exp
*
1000
;
delete
userInfo
.
exp
;
delete
userInfo
.
iat
;
return
userInfo
;
}
function
uniIdMixin
(
globalProperties
)
{
globalProperties
.
uniIDHasRole
=
function
(
roleId
)
{
const
{
role
}
=
getCurrentUserInfo
();
return
role
.
indexOf
(
roleId
)
>
-
1
;
};
globalProperties
.
uniIDHasPermission
=
function
(
permissionId
)
{
const
{
permission
}
=
getCurrentUserInfo
();
return
this
.
uniIDHasRole
(
'
admin
'
)
||
permission
.
indexOf
(
permissionId
)
>
-
1
;
};
globalProperties
.
uniIDTokenValid
=
function
()
{
const
{
tokenExpired
}
=
getCurrentUserInfo
();
return
tokenExpired
>
Date
.
now
();
};
}
function
initApp
(
app
)
{
const
appConfig
=
app
.
_context
.
config
;
if
(
isFunction
(
app
.
_component
.
onError
))
{
appConfig
.
errorHandler
=
errorHandler
;
}
initOptionMergeStrategies
(
appConfig
.
optionMergeStrategies
);
const
globalProperties
=
appConfig
.
globalProperties
;
{
uniIdMixin
(
globalProperties
);
}
{
globalProperties
.
$set
=
set
;
globalProperties
.
$applyOptions
=
applyOptions
;
}
}
export
{
initApp
};
packages/uni-app-plus/src/service/vue.ts
0 → 100644
浏览文件 @
c838528e
export
{
initApp
}
from
'
@dcloudio/uni-vue
'
packages/uni-app-plus/vite.config.ts
浏览文件 @
c838528e
...
...
@@ -57,7 +57,6 @@ export default defineConfig({
define
:
{
global
:
'
window
'
,
__DEV__
:
false
,
__NVUE__
:
false
,
__TEST__
:
false
,
__PLATFORM__
:
JSON
.
stringify
(
'
app
'
),
__NODE_JS__
:
false
,
...
...
packages/uni-app-vue/build.json
浏览文件 @
c838528e
...
...
@@ -4,21 +4,14 @@
"src/service/index.ts"
:
[
"dist/service.runtime.esm.dev.js"
]
},
"output"
:
{
"freeze"
:
false
,
"banner"
:
"function vueFactory (exports) {
\n
"
,
"footer"
:
"}"
,
"format"
:
"iife"
,
"globals"
:
{
"@vue/shared"
:
"exports.VueShared"
,
"@vue/reactivity"
:
"exports.VueReactivity"
}
"freeze"
:
false
},
"replacements"
:
{
"__VUE_OPTIONS_API__"
:
"true"
,
"__VUE_PROD_DEVTOOLS__"
:
"false"
,
"process.env.NODE_ENV"
:
"
\"
development
\"
"
},
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
],
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
,
"@dcloudio/uni-shared"
],
"babel"
:
true
},
{
...
...
@@ -26,21 +19,14 @@
"src/service/index.ts"
:
[
"dist/service.runtime.esm.prod.js"
]
},
"output"
:
{
"freeze"
:
false
,
"banner"
:
"function vueFactory (exports) {
\n
"
,
"footer"
:
"}"
,
"format"
:
"iife"
,
"globals"
:
{
"@vue/shared"
:
"exports.VueShared"
,
"@vue/reactivity"
:
"exports.VueReactivity"
}
"freeze"
:
false
},
"replacements"
:
{
"__VUE_OPTIONS_API__"
:
"true"
,
"__VUE_PROD_DEVTOOLS__"
:
"false"
,
"process.env.NODE_ENV"
:
"
\"
production
\"
"
},
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
],
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
,
"@dcloudio/uni-shared"
],
"babel"
:
true
},
{
...
...
@@ -58,21 +44,14 @@
"src/nvue/index.ts"
:
[
"dist/nvue.runtime.esm.dev.js"
]
},
"output"
:
{
"freeze"
:
false
,
"banner"
:
"function nvueFactory (exports, document) {
\n
"
,
"footer"
:
"}"
,
"format"
:
"iife"
,
"globals"
:
{
"@vue/shared"
:
"exports.VueShared"
,
"@vue/reactivity"
:
"exports.VueReactivity"
}
"freeze"
:
false
},
"replacements"
:
{
"__VUE_OPTIONS_API__"
:
"true"
,
"__VUE_PROD_DEVTOOLS__"
:
"false"
,
"process.env.NODE_ENV"
:
"
\"
development
\"
"
},
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
],
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
,
"@dcloudio/uni-shared"
],
"babel"
:
true
},
{
...
...
@@ -80,21 +59,14 @@
"src/nvue/index.ts"
:
[
"dist/nvue.runtime.esm.prod.js"
]
},
"output"
:
{
"freeze"
:
false
,
"banner"
:
"function nvueFactory (exports, document) {
\n
"
,
"footer"
:
"}"
,
"format"
:
"iife"
,
"globals"
:
{
"@vue/shared"
:
"exports.VueShared"
,
"@vue/reactivity"
:
"exports.VueReactivity"
}
"freeze"
:
false
},
"replacements"
:
{
"__VUE_OPTIONS_API__"
:
"true"
,
"__VUE_PROD_DEVTOOLS__"
:
"false"
,
"process.env.NODE_ENV"
:
"
\"
production
\"
"
},
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
],
"external"
:
[
"@vue/shared"
,
"@vue/reactivity"
,
"@dcloudio/uni-shared"
],
"babel"
:
true
}
]
packages/uni-app-vue/dist/nvue.runtime.esm.dev.js
浏览文件 @
c838528e
此差异已折叠。
点击以展开。
packages/uni-app-vue/dist/nvue.runtime.esm.prod.js
浏览文件 @
c838528e
此差异已折叠。
点击以展开。
packages/uni-app-vue/dist/service.runtime.esm.dev.js
浏览文件 @
c838528e
此差异已折叠。
点击以展开。
packages/uni-app-vue/dist/service.runtime.esm.prod.js
浏览文件 @
c838528e
此差异已折叠。
点击以展开。
packages/uni-app-vue/lib/service.runtime.esm.js
浏览文件 @
c838528e
import
{
isRootHook
,
resolveOwnerEl
,
ATTR_V_OWNER_ID
,
ATTR_V_RENDERJS
,
UniInputElement
,
UniTextAreaElement
,
UniElement
,
UniTextNode
,
UniCommentNode
,
JSON_PROTOCOL
,
forcePatchProp
}
from
'
@dcloudio/uni-shared
'
;
import
{
isString
,
isFunction
,
isPromise
,
isArray
,
NOOP
,
getGlobalThis
,
extend
,
EMPTY_OBJ
,
toHandlerKey
,
toNumber
,
hyphenate
,
camelize
,
isOn
,
hasOwn
,
isModelListener
,
hasChanged
,
remove
,
isObject
,
isSet
,
isMap
,
isPlainObject
,
invokeArrayFns
,
def
,
isReservedProp
,
EMPTY_ARR
,
capitalize
,
toRawType
,
makeMap
,
isBuiltInDirective
,
NO
,
normalizeClass
,
normalizeStyle
,
isGloballyWhitelisted
,
isHTMLTag
,
isSVGTag
}
from
'
@vue/shared
'
;
export
{
camelize
,
capitalize
,
normalizeClass
,
normalizeProps
,
normalizeStyle
,
toDisplayString
,
toHandlerKey
}
from
'
@vue/shared
'
;
import
{
pauseTracking
,
resetTracking
,
isRef
,
toRaw
,
isShallow
as
isShallow$1
,
isReactive
,
ReactiveEffect
,
ref
,
reactive
,
shallowReactive
,
trigger
,
isProxy
,
shallowReadonly
,
track
,
EffectScope
,
markRaw
,
proxyRefs
,
computed
as
computed$1
,
isReadonly
}
from
'
@vue/reactivity
'
;
export
{
EffectScope
,
ReactiveEffect
,
customRef
,
effect
,
effectScope
,
getCurrentScope
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
isShallow
,
markRaw
,
onScopeDispose
,
proxyRefs
,
reactive
,
readonly
,
ref
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
stop
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
}
from
'
@vue/reactivity
'
;
/**
* Make a map and return a function for checking if a key
* is in that map.
* IMPORTANT: all calls of this function must be prefixed with
* \/\*#\_\_PURE\_\_\*\/
* So that rollup can tree-shake them if necessary.
*/
function
makeMap
(
str
,
expectsLowerCase
)
{
const
map
=
Object
.
create
(
null
);
const
list
=
str
.
split
(
'
,
'
);
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
map
[
list
[
i
]]
=
true
;
}
return
expectsLowerCase
?
val
=>
!!
map
[
val
.
toLowerCase
()]
:
val
=>
!!
map
[
val
];
}
const
GLOBALS_WHITE_LISTED
=
'
Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,
'
+
'
decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,
'
+
'
Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt
'
;
const
isGloballyWhitelisted
=
/*#__PURE__*/
makeMap
(
GLOBALS_WHITE_LISTED
);
function
normalizeStyle
(
value
)
{
if
(
isArray
(
value
))
{
const
res
=
{};
for
(
let
i
=
0
;
i
<
value
.
length
;
i
++
)
{
const
item
=
value
[
i
];
const
normalized
=
isString
(
item
)
?
parseStringStyle
(
item
)
:
normalizeStyle
(
item
);
if
(
normalized
)
{
for
(
const
key
in
normalized
)
{
res
[
key
]
=
normalized
[
key
];
}
}
}
return
res
;
}
else
if
(
isString
(
value
))
{
return
value
;
}
else
if
(
isObject
(
value
))
{
return
value
;
}
}
const
listDelimiterRE
=
/;
(?![^
(
]
*
\))
/g
;
const
propertyDelimiterRE
=
/:
(
.+
)
/
;
function
parseStringStyle
(
cssText
)
{
const
ret
=
{};
cssText
.
split
(
listDelimiterRE
).
forEach
(
item
=>
{
if
(
item
)
{
const
tmp
=
item
.
split
(
propertyDelimiterRE
);
tmp
.
length
>
1
&&
(
ret
[
tmp
[
0
].
trim
()]
=
tmp
[
1
].
trim
());
}
});
return
ret
;
}
function
normalizeClass
(
value
)
{
let
res
=
''
;
if
(
isString
(
value
))
{
res
=
value
;
}
else
if
(
isArray
(
value
))
{
for
(
let
i
=
0
;
i
<
value
.
length
;
i
++
)
{
const
normalized
=
normalizeClass
(
value
[
i
]);
if
(
normalized
)
{
res
+=
normalized
+
'
'
;
}
}
}
else
if
(
isObject
(
value
))
{
for
(
const
name
in
value
)
{
if
(
value
[
name
])
{
res
+=
name
+
'
'
;
}
}
}
return
res
.
trim
();
}
function
normalizeProps
(
props
)
{
if
(
!
props
)
return
null
;
let
{
class
:
klass
,
style
}
=
props
;
if
(
klass
&&
!
isString
(
klass
))
{
props
.
class
=
normalizeClass
(
klass
);
}
if
(
style
)
{
props
.
style
=
normalizeStyle
(
style
);
}
return
props
;
}
// These tag configs are shared between compiler-dom and runtime-dom, so they
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
const
HTML_TAGS
=
'
html,body,base,head,link,meta,style,title,address,article,aside,footer,
'
+
'
header,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,
'
+
'
figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,
'
+
'
data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,
'
+
'
time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,
'
+
'
canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,
'
+
'
th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,
'
+
'
option,output,progress,select,textarea,details,dialog,menu,
'
+
'
summary,template,blockquote,iframe,tfoot
'
;
// https://developer.mozilla.org/en-US/docs/Web/SVG/Element
const
SVG_TAGS
=
'
svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,
'
+
'
defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,
'
+
'
feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,
'
+
'
feDistanceLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,
'
+
'
feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,
'
+
'
fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,
'
+
'
foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,
'
+
'
mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,
'
+
'
polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,
'
+
'
text,textPath,title,tspan,unknown,use,view
'
;
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
*/
const
isHTMLTag
=
/*#__PURE__*/
makeMap
(
HTML_TAGS
);
/**
* Compiler only.
* Do NOT use in runtime code paths unless behind `(process.env.NODE_ENV !== 'production')` flag.
*/
const
isSVGTag
=
/*#__PURE__*/
makeMap
(
SVG_TAGS
);
/**
* For converting {{ interpolation }} values to displayed strings.
* @private
*/
const
toDisplayString
=
(
val
)
=>
{
return
isString
(
val
)
?
val
:
val
==
null
?
''
:
isArray
(
val
)
||
(
isObject
(
val
)
&&
(
val
.
toString
===
objectToString
||
!
isFunction
(
val
.
toString
)))
?
JSON
.
stringify
(
val
,
replacer
,
2
)
:
String
(
val
);
};
const
replacer
=
(
_key
,
val
)
=>
{
// can't use isRef here since @vue/shared has no deps
if
(
val
&&
val
.
__v_isRef
)
{
return
replacer
(
_key
,
val
.
value
);
}
else
if
(
isMap
(
val
))
{
return
{
[
`Map(
${
val
.
size
}
)`
]:
[...
val
.
entries
()].
reduce
((
entries
,
[
key
,
val
])
=>
{
entries
[
`
${
key
}
=>`
]
=
val
;
return
entries
;
},
{})
};
}
else
if
(
isSet
(
val
))
{
return
{
[
`Set(
${
val
.
size
}
)`
]:
[...
val
.
values
()]
};
}
else
if
(
isObject
(
val
)
&&
!
isArray
(
val
)
&&
!
isPlainObject
(
val
))
{
return
String
(
val
);
}
return
val
;
};
const
EMPTY_OBJ
=
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
Object
.
freeze
({})
:
{};
const
EMPTY_ARR
=
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
?
Object
.
freeze
([])
:
[];
const
NOOP
=
()
=>
{
};
/**
* Always return false.
*/
const
NO
=
()
=>
false
;
const
onRE
=
/^on
[^
a-z
]
/
;
const
isOn
=
(
key
)
=>
onRE
.
test
(
key
);
const
isModelListener
=
(
key
)
=>
key
.
startsWith
(
'
onUpdate:
'
);
const
extend
=
Object
.
assign
;
const
remove
=
(
arr
,
el
)
=>
{
const
i
=
arr
.
indexOf
(
el
);
if
(
i
>
-
1
)
{
arr
.
splice
(
i
,
1
);
}
};
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
const
hasOwn
=
(
val
,
key
)
=>
hasOwnProperty
.
call
(
val
,
key
);
const
isArray
=
Array
.
isArray
;
const
isMap
=
(
val
)
=>
toTypeString
(
val
)
===
'
[object Map]
'
;
const
isSet
=
(
val
)
=>
toTypeString
(
val
)
===
'
[object Set]
'
;
const
isFunction
=
(
val
)
=>
typeof
val
===
'
function
'
;
const
isString
=
(
val
)
=>
typeof
val
===
'
string
'
;
const
isObject
=
(
val
)
=>
val
!==
null
&&
typeof
val
===
'
object
'
;
const
isPromise
=
(
val
)
=>
{
return
isObject
(
val
)
&&
isFunction
(
val
.
then
)
&&
isFunction
(
val
.
catch
);
};
const
objectToString
=
Object
.
prototype
.
toString
;
const
toTypeString
=
(
value
)
=>
objectToString
.
call
(
value
);
const
toRawType
=
(
value
)
=>
{
// extract "RawType" from strings like "[object RawType]"
return
toTypeString
(
value
).
slice
(
8
,
-
1
);
};
const
isPlainObject
=
(
val
)
=>
toTypeString
(
val
)
===
'
[object Object]
'
;
const
isReservedProp
=
/*#__PURE__*/
makeMap
(
// the leading comma is intentional so empty string "" is also included
'
,key,ref,ref_for,ref_key,
'
+
'
onVnodeBeforeMount,onVnodeMounted,
'
+
'
onVnodeBeforeUpdate,onVnodeUpdated,
'
+
'
onVnodeBeforeUnmount,onVnodeUnmounted
'
);
const
isBuiltInDirective
=
/*#__PURE__*/
makeMap
(
'
bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo
'
);
const
cacheStringFunction
=
(
fn
)
=>
{
const
cache
=
Object
.
create
(
null
);
return
((
str
)
=>
{
const
hit
=
cache
[
str
];
return
hit
||
(
cache
[
str
]
=
fn
(
str
));
});
};
const
camelizeRE
=
/-
(\w)
/g
;
/**
* @private
*/
const
camelize
=
cacheStringFunction
((
str
)
=>
{
return
str
.
replace
(
camelizeRE
,
(
_
,
c
)
=>
(
c
?
c
.
toUpperCase
()
:
''
));
});
const
hyphenateRE
=
/
\B([
A-Z
])
/g
;
/**
* @private
*/
const
hyphenate
=
cacheStringFunction
((
str
)
=>
str
.
replace
(
hyphenateRE
,
'
-$1
'
).
toLowerCase
());
/**
* @private
*/
const
capitalize
=
cacheStringFunction
((
str
)
=>
str
.
charAt
(
0
).
toUpperCase
()
+
str
.
slice
(
1
));
/**
* @private
*/
const
toHandlerKey
=
cacheStringFunction
((
str
)
=>
str
?
`on
${
capitalize
(
str
)}
`
:
``
);
// compare whether a value has changed, accounting for NaN.
const
hasChanged
=
(
value
,
oldValue
)
=>
!
Object
.
is
(
value
,
oldValue
);
const
invokeArrayFns
=
(
fns
,
arg
)
=>
{
for
(
let
i
=
0
;
i
<
fns
.
length
;
i
++
)
{
fns
[
i
](
arg
);
}
};
const
def
=
(
obj
,
key
,
value
)
=>
{
Object
.
defineProperty
(
obj
,
key
,
{
configurable
:
true
,
enumerable
:
false
,
value
});
};
const
toNumber
=
(
val
)
=>
{
const
n
=
parseFloat
(
val
);
return
isNaN
(
n
)
?
val
:
n
;
};
let
_globalThis
;
const
getGlobalThis
=
()
=>
{
return
(
_globalThis
||
(
_globalThis
=
typeof
globalThis
!==
'
undefined
'
?
globalThis
:
typeof
self
!==
'
undefined
'
?
self
:
typeof
window
!==
'
undefined
'
?
window
:
typeof
global
!==
'
undefined
'
?
global
:
{}));
};
const
stack
=
[];
function
pushWarningContext
(
vnode
)
{
stack
.
push
(
vnode
);
...
...
@@ -8918,4 +8653,4 @@ function injectNativeTagCheck(app) {
function
onBeforeActivate
()
{
}
function
onBeforeDeactivate
()
{
}
export
{
BaseTransition
,
Comment
,
Fragment
,
KeepAlive
,
Static
,
Suspense
,
Teleport
,
Text
,
Transition
,
TransitionGroup
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
c
amelize
,
capitalize
,
cloneVNode
,
compatUtils
,
computed
,
createApp
,
createBlock
,
createComment
,
createCommentVNode
,
createElement
,
createElementBlock
,
createBaseVNode
as
createElementVNode
,
createHydrationRenderer
,
createPropsRestProxy
,
createRenderer
,
createSSRApp
,
createSlots
,
createStaticVNode
,
createTextNode
,
createTextVNode
,
createVNode
,
createApp
as
createVueApp
,
defineAsyncComponent
,
defineComponent
,
defineEmits
,
defineExpose
,
defineProps
,
devtools
,
getCurrentInstance
,
getTransitionRawChildren
,
guardReactiveProps
,
h
,
handleError
,
initCustomFormatter
,
inject
,
injectHook
,
isInSSRComponentSetup
,
isMemoSame
,
isRuntimeOnly
,
isVNode
,
mergeDefaults
,
mergeProps
,
nextTick
,
normalizeClass
,
normalizeProps
,
normalizeStyle
,
onActivated
,
onBeforeActivate
,
onBeforeDeactivate
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onErrorCaptured
,
onMounted
,
onRenderTracked
,
onRenderTriggered
,
onServerPrefetch
,
onUnmounted
,
onUpdated
,
openBlock
,
popScopeId
,
provide
,
pushScopeId
,
queuePostFlushCb
,
registerRuntimeCompiler
,
render
,
renderList
,
renderSlot
,
resolveComponent
,
resolveDirective
,
resolveDynamicComponent
,
resolveFilter
,
resolveTransitionHooks
,
setBlockTracking
,
setDevtoolsHook
,
setTransitionHooks
,
ssrContextKey
,
ssrUtils
,
toDisplayString
,
toHandlerKey
,
toHandlers
,
transformVNodeArgs
,
useAttrs
,
useCssModule
,
useCssVars
,
useSSRContext
,
useSlots
,
useTransitionState
,
vModelText
,
vShow
,
version
,
warn
,
watch
,
watchEffect
,
watchPostEffect
,
watchSyncEffect
,
withAsyncContext
,
withCtx
,
withDefaults
,
withDirectives
,
withKeys
,
withMemo
,
withModifiers
,
withScopeId
};
export
{
BaseTransition
,
Comment
,
Fragment
,
KeepAlive
,
Static
,
Suspense
,
Teleport
,
Text
,
Transition
,
TransitionGroup
,
callWithAsyncErrorHandling
,
callWithErrorHandling
,
c
loneVNode
,
compatUtils
,
computed
,
createApp
,
createBlock
,
createComment
,
createCommentVNode
,
createElement
,
createElementBlock
,
createBaseVNode
as
createElementVNode
,
createHydrationRenderer
,
createPropsRestProxy
,
createRenderer
,
createSSRApp
,
createSlots
,
createStaticVNode
,
createTextNode
,
createTextVNode
,
createVNode
,
createApp
as
createVueApp
,
defineAsyncComponent
,
defineComponent
,
defineEmits
,
defineExpose
,
defineProps
,
devtools
,
getCurrentInstance
,
getTransitionRawChildren
,
guardReactiveProps
,
h
,
handleError
,
initCustomFormatter
,
inject
,
injectHook
,
isInSSRComponentSetup
,
isMemoSame
,
isRuntimeOnly
,
isVNode
,
mergeDefaults
,
mergeProps
,
nextTick
,
onActivated
,
onBeforeActivate
,
onBeforeDeactivate
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onErrorCaptured
,
onMounted
,
onRenderTracked
,
onRenderTriggered
,
onServerPrefetch
,
onUnmounted
,
onUpdated
,
openBlock
,
popScopeId
,
provide
,
pushScopeId
,
queuePostFlushCb
,
registerRuntimeCompiler
,
render
,
renderList
,
renderSlot
,
resolveComponent
,
resolveDirective
,
resolveDynamicComponent
,
resolveFilter
,
resolveTransitionHooks
,
setBlockTracking
,
setDevtoolsHook
,
setTransitionHooks
,
ssrContextKey
,
ssrUtils
,
toHandlers
,
transformVNodeArgs
,
useAttrs
,
useCssModule
,
useCssVars
,
useSSRContext
,
useSlots
,
useTransitionState
,
vModelText
,
vShow
,
version
,
warn
,
watch
,
watchEffect
,
watchPostEffect
,
watchSyncEffect
,
withAsyncContext
,
withCtx
,
withDefaults
,
withDirectives
,
withKeys
,
withMemo
,
withModifiers
,
withScopeId
};
packages/uni-components/build.json
浏览文件 @
c838528e
...
...
@@ -4,7 +4,6 @@
"src/nvue/index.ts"
:
[
"dist/nvue.js"
]
},
"replacements"
:
{
"__NVUE__"
:
"true"
,
"__PLATFORM__"
:
"'app'"
,
"__APP_VIEW__"
:
"false"
,
"__VUE_OPTIONS_API__"
:
"true"
,
...
...
packages/uni-components/vite.config.ts
浏览文件 @
c838528e
...
...
@@ -11,7 +11,6 @@ export default defineConfig({
root
:
__dirname
,
define
:
{
global
:
'
window
'
,
__NVUE__
:
true
,
},
resolve
:
{
alias
:
[
...
...
packages/uni-vue/src/componentOptions/index.ts
浏览文件 @
c838528e
...
...
@@ -14,7 +14,7 @@ export function applyOptions(
instance
:
ComponentInternalInstance
,
publicThis
:
ComponentPublicInstance
)
{
if
(
__PLATFORM__
===
'
app
'
&&
!
__NVUE__
)
{
if
(
__PLATFORM__
===
'
app
'
)
{
initWxs
(
options
,
instance
)
initRenderjs
(
options
,
instance
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录