Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
8ed4e2b1
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
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,发现更多精彩内容 >>
提交
8ed4e2b1
编写于
12月 02, 2020
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(vue3-mp): export defineComponent...
上级
9d30f60b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
89 addition
and
2 deletion
+89
-2
packages/uni-mp-vue/dist/vue.runtime.esm.js
packages/uni-mp-vue/dist/vue.runtime.esm.js
+86
-2
packages/vue-cli-plugin-uni/lib/vue-loader.js
packages/vue-cli-plugin-uni/lib/vue-loader.js
+3
-0
未找到文件。
packages/uni-mp-vue/dist/vue.runtime.esm.js
浏览文件 @
8ed4e2b1
import
{
isSymbol
,
extend
,
isMap
,
isObject
,
toRawType
,
def
,
isArray
,
isString
,
isFunction
,
isPromise
,
toHandlerKey
,
remove
,
EMPTY_OBJ
,
NOOP
,
isGloballyWhitelisted
,
isIntegerKey
,
hasOwn
,
hasChanged
,
capitalize
,
NO
,
invokeArrayFns
,
isSet
,
makeMap
,
toNumber
,
hyphenate
,
cameliz
e
,
isReservedProp
,
EMPTY_ARR
,
toTypeString
,
isOn
}
from
'
@vue/shared
'
;
import
{
isSymbol
,
extend
,
isMap
,
isObject
,
toRawType
,
def
,
isArray
,
isString
,
isFunction
,
isPromise
,
capitalize
,
toHandlerKey
,
remove
,
EMPTY_OBJ
,
NOOP
,
isGloballyWhitelisted
,
isIntegerKey
,
hasOwn
,
hasChanged
,
camelize
,
NO
,
invokeArrayFns
,
isSet
,
makeMap
,
toNumber
,
hyphenat
e
,
isReservedProp
,
EMPTY_ARR
,
toTypeString
,
isOn
}
from
'
@vue/shared
'
;
export
{
camelize
}
from
'
@vue/shared
'
;
const
targetMap
=
new
WeakMap
();
...
...
@@ -1366,6 +1366,57 @@ let currentRenderingInstance = null;
function
markAttrsAccessed
()
{
}
const
COMPONENTS
=
'
components
'
;
const
DIRECTIVES
=
'
directives
'
;
/**
* @private
*/
function
resolveDirective
(
name
)
{
return
resolveAsset
(
DIRECTIVES
,
name
);
}
// implementation
function
resolveAsset
(
type
,
name
,
warnMissing
=
true
)
{
const
instance
=
currentInstance
;
if
(
instance
)
{
const
Component
=
instance
.
type
;
// self name has highest priority
if
(
type
===
COMPONENTS
)
{
// special self referencing call generated by compiler
// inferred from SFC filename
if
(
name
===
`_self`
)
{
return
Component
;
}
const
selfName
=
Component
.
displayName
||
Component
.
name
;
if
(
selfName
&&
(
selfName
===
name
||
selfName
===
camelize
(
name
)
||
selfName
===
capitalize
(
camelize
(
name
))))
{
return
Component
;
}
}
const
res
=
// local registration
// check instance[type] first for components with mixin or extends.
resolve
(
instance
[
type
]
||
Component
[
type
],
name
)
||
// global registration
resolve
(
instance
.
appContext
[
type
],
name
);
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
warnMissing
&&
!
res
)
{
warn
(
`Failed to resolve
${
type
.
slice
(
0
,
-
1
)}
:
${
name
}
`
);
}
return
res
;
}
else
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`resolve
${
capitalize
(
type
.
slice
(
0
,
-
1
))}
`
+
`can only be used in render() or setup().`
);
}
}
function
resolve
(
registry
,
name
)
{
return
(
registry
&&
(
registry
[
name
]
||
registry
[
camelize
(
name
)]
||
registry
[
capitalize
(
camelize
(
name
))]));
}
function
initProps
(
instance
,
rawProps
,
isStateful
,
// result of bitwise flag comparison
isSSR
=
false
)
{
const
props
=
{};
...
...
@@ -1798,6 +1849,15 @@ function validateDirectiveName(name) {
if
(
isBuiltInDirective
(
name
))
{
warn
(
'
Do not use built-in directive ids as custom directive id:
'
+
name
);
}
}
/**
* Adds directives to a VNode.
*/
function
withDirectives
(
vnode
,
directives
)
{
{
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
&&
warn
(
`withDirectives can only be used inside render functions.`
);
return
vnode
;
}
}
function
createAppContext
()
{
...
...
@@ -1928,6 +1988,11 @@ function createAppAPI() {
};
}
// implementation, close to no-op
function
defineComponent
(
options
)
{
return
isFunction
(
options
)
?
{
setup
:
options
,
name
:
options
.
name
}
:
options
;
}
const
queuePostRenderEffect
=
queuePostFlushCb
;
// Simple effect.
...
...
@@ -3158,6 +3223,25 @@ function computed$1(getterOrOptions) {
return
c
;
}
// implementation
function
defineProps
()
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`defineProps() is a compiler-hint helper that is only usable inside `
+
`<script setup> of a single file component. Its arguments should be `
+
`compiled away and passing it at runtime has no effect.`
);
}
return
null
;
}
// implementation
function
defineEmit
()
{
if
((
process
.
env
.
NODE_ENV
!==
'
production
'
))
{
warn
(
`defineEmit() is a compiler-hint helper that is only usable inside `
+
`<script setup> of a single file component. Its arguments should be `
+
`compiled away and passing it at runtime has no effect.`
);
}
return
null
;
}
// Core API ------------------------------------------------------------------
const
version
=
"
3.0.3
"
;
...
...
@@ -3685,4 +3769,4 @@ function createApp(rootComponent, rootProps = null) {
return
createVueApp
(
rootComponent
,
rootProps
).
use
(
plugin
);
}
export
{
callWithAsyncErrorHandling
,
callWithErrorHandling
,
computed$1
as
computed
,
createApp
,
createHook$1
as
createHook
,
createVueApp
,
customRef
,
inject
,
injectHook
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
logError
,
markRaw
,
nextTick
,
onActivated
,
onAddToFavorites
,
onBackPress
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onError
,
onErrorCaptured
,
onHide
,
onLaunch
,
onLoad
,
onMounted
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onRenderTracked
,
onRenderTriggered
,
onResize
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
onUnmounted
,
onUpdated
,
provide
,
reactive
,
readonly
,
ref
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
,
version
,
warn
,
watch
,
watchEffect
};
export
{
callWithAsyncErrorHandling
,
callWithErrorHandling
,
computed$1
as
computed
,
createApp
,
createHook$1
as
createHook
,
createVueApp
,
customRef
,
defineComponent
,
defineEmit
,
defineProps
,
inject
,
injectHook
,
isInSSRComponentSetup
,
isProxy
,
isReactive
,
isReadonly
,
isRef
,
logError
,
markRaw
,
nextTick
,
onActivated
,
onAddToFavorites
,
onBackPress
,
onBeforeMount
,
onBeforeUnmount
,
onBeforeUpdate
,
onDeactivated
,
onError
,
onErrorCaptured
,
onHide
,
onLaunch
,
onLoad
,
onMounted
,
onNavigationBarButtonTap
,
onNavigationBarSearchInputChanged
,
onNavigationBarSearchInputClicked
,
onNavigationBarSearchInputConfirmed
,
onNavigationBarSearchInputFocusChanged
,
onPageNotFound
,
onPageScroll
,
onPullDownRefresh
,
onReachBottom
,
onReady
,
onRenderTracked
,
onRenderTriggered
,
onResize
,
onShareAppMessage
,
onShareTimeline
,
onShow
,
onTabItemTap
,
onThemeChange
,
onUnhandledRejection
,
onUnload
,
onUnmounted
,
onUpdated
,
provide
,
reactive
,
readonly
,
ref
,
resolveDirective
,
shallowReactive
,
shallowReadonly
,
shallowRef
,
toRaw
,
toRef
,
toRefs
,
triggerRef
,
unref
,
version
,
warn
,
watch
,
watchEffect
,
withDirectives
};
packages/vue-cli-plugin-uni/lib/vue-loader.js
浏览文件 @
8ed4e2b1
...
...
@@ -27,6 +27,9 @@ module.exports = function modifyVueLoader (webpackConfig, loaderOptions, compile
.
tap
(
options
=>
Object
.
assign
(
options
,
vueLoader
.
options
(
loaderOptions
,
compilerOptions
),
cacheConfig
))
.
end
()
// 强制使用vue2,vue3时会使用vue-loader-v16
webpackConfig
.
plugin
(
'
vue-loader
'
).
use
(
require
(
vueLoader
.
loader
).
VueLoaderPlugin
)
// h5 框架需要使用 scoped 样式,其他平台编译时识别是否 nvue 文件且注入 flex 相关样式
if
(
process
.
env
.
UNI_PLATFORM
===
'
h5
'
)
{
webpackConfig
.
module
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录