Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
1248259c
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1248259c
编写于
2月 08, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): nvue
上级
fba511eb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
115 addition
and
13 deletion
+115
-13
packages/uni-components/build.json
packages/uni-components/build.json
+7
-0
packages/uni-components/dist/bridge.js
packages/uni-components/dist/bridge.js
+81
-0
packages/uni-components/dist/components.js
packages/uni-components/dist/components.js
+6
-8
packages/uni-components/src/nvue/bridge.ts
packages/uni-components/src/nvue/bridge.ts
+2
-0
packages/uni-components/vite.config.ts
packages/uni-components/vite.config.ts
+17
-2
packages/uni-core/src/helpers/bridge.ts
packages/uni-core/src/helpers/bridge.ts
+1
-3
packages/uni-core/src/index.ts
packages/uni-core/src/index.ts
+1
-0
未找到文件。
packages/uni-components/build.json
0 → 100644
浏览文件 @
1248259c
[
{
"input"
:
{
"src/nvue/bridge.ts"
:
[
"dist/bridge.js"
]
}
}
]
packages/uni-components/dist/bridge.js
0 → 100644
浏览文件 @
1248259c
const
E
=
function
()
{
// Keep this empty so it's easier to inherit from
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
};
E
.
prototype
=
{
on
:
function
(
name
,
callback
,
ctx
)
{
var
e
=
this
.
e
||
(
this
.
e
=
{});
(
e
[
name
]
||
(
e
[
name
]
=
[])).
push
({
fn
:
callback
,
ctx
:
ctx
,
});
return
this
;
},
once
:
function
(
name
,
callback
,
ctx
)
{
var
self
=
this
;
function
listener
()
{
self
.
off
(
name
,
listener
);
callback
.
apply
(
ctx
,
arguments
);
}
listener
.
_
=
callback
;
return
this
.
on
(
name
,
listener
,
ctx
);
},
emit
:
function
(
name
)
{
var
data
=
[].
slice
.
call
(
arguments
,
1
);
var
evtArr
=
((
this
.
e
||
(
this
.
e
=
{}))[
name
]
||
[]).
slice
();
var
i
=
0
;
var
len
=
evtArr
.
length
;
for
(
i
;
i
<
len
;
i
++
)
{
evtArr
[
i
].
fn
.
apply
(
evtArr
[
i
].
ctx
,
data
);
}
return
this
;
},
off
:
function
(
name
,
callback
)
{
var
e
=
this
.
e
||
(
this
.
e
=
{});
var
evts
=
e
[
name
];
var
liveEvents
=
[];
if
(
evts
&&
callback
)
{
for
(
var
i
=
0
,
len
=
evts
.
length
;
i
<
len
;
i
++
)
{
if
(
evts
[
i
].
fn
!==
callback
&&
evts
[
i
].
fn
.
_
!==
callback
)
liveEvents
.
push
(
evts
[
i
]);
}
}
// Remove event from queue to prevent memory leak
// Suggested by https://github.com/lazd
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
liveEvents
.
length
?
(
e
[
name
]
=
liveEvents
)
:
delete
e
[
name
];
return
this
;
},
};
var
E$1
=
E
;
function
initBridge
(
subscribeNamespace
)
{
const
emitter
=
new
E$1
();
return
{
on
(
event
,
callback
)
{
return
emitter
.
on
(
event
,
callback
);
},
once
(
event
,
callback
)
{
return
emitter
.
once
(
event
,
callback
);
},
off
(
event
,
callback
)
{
return
emitter
.
off
(
event
,
callback
);
},
emit
(
event
,
...
args
)
{
return
emitter
.
emit
(
event
,
...
args
);
},
subscribe
(
event
,
callback
,
once
=
false
)
{
emitter
[
once
?
'
once
'
:
'
on
'
](
`
${
subscribeNamespace
}
.
${
event
}
`
,
callback
);
},
unsubscribe
(
event
,
callback
)
{
emitter
.
off
(
`
${
subscribeNamespace
}
.
${
event
}
`
,
callback
);
},
subscribeHandler
(
event
,
args
,
pageId
)
{
emitter
.
emit
(
`
${
subscribeNamespace
}
.
${
event
}
`
,
args
,
pageId
);
},
};
}
const
UniViewJSBridge
=
initBridge
(
'
nvue
'
);
export
{
UniViewJSBridge
};
packages/uni-components/dist/components.js
浏览文件 @
1248259c
export
function
initComponents
(
uni
,
Vue
,
weex
)
{
var
components
=
function
(
vue
)
{
export
function
initComponents
(
{
uni
,
Vue
,
weex
,
plus
,
BroadcastChannel
}
)
{
var
components
=
function
(
vue
,
shared
)
{
"
use strict
"
;
const
OPEN_TYPES
=
[
"
navigate
"
,
...
...
@@ -81,18 +81,16 @@ export function initComponents(uni, Vue, weex) {
}
};
}
const
hasOwnProperty
=
Object
.
prototype
.
hasOwnProperty
;
const
hasOwn
=
(
val
,
key
)
=>
hasOwnProperty
.
call
(
val
,
key
);
function
useHoverClass
(
props
)
{
if
(
props
.
hoverClass
&&
props
.
hoverClass
!==
"
none
"
)
{
const
hoverAttrs
=
{
hoverClass
:
props
.
hoverClass
};
if
(
hasOwn
(
props
,
"
hoverStartTime
"
))
{
if
(
shared
.
hasOwn
(
props
,
"
hoverStartTime
"
))
{
hoverAttrs
.
hoverStartTime
=
props
.
hoverStartTime
;
}
if
(
hasOwn
(
props
,
"
hoverStayTime
"
))
{
if
(
shared
.
hasOwn
(
props
,
"
hoverStayTime
"
))
{
hoverAttrs
.
hoverStayTime
=
props
.
hoverStayTime
;
}
if
(
hasOwn
(
props
,
"
hoverStopPropagation
"
))
{
if
(
shared
.
hasOwn
(
props
,
"
hoverStopPropagation
"
))
{
hoverAttrs
.
hoverStopPropagation
=
props
.
hoverStopPropagation
;
}
return
hoverAttrs
;
...
...
@@ -124,6 +122,6 @@ export function initComponents(uni, Vue, weex) {
Navigator
};
return
index
;
}(
Vue
);
}(
Vue
,
VueShared
);
return
components
;
}
packages/uni-components/src/nvue/bridge.ts
0 → 100644
浏览文件 @
1248259c
import
{
initBridge
}
from
'
@dcloudio/uni-core
'
export
const
UniViewJSBridge
=
initBridge
(
'
nvue
'
)
packages/uni-components/vite.config.ts
浏览文件 @
1248259c
...
...
@@ -2,8 +2,21 @@ import path from 'path'
import
{
defineConfig
}
from
'
vite
'
import
vue
from
'
@vitejs/plugin-vue
'
import
vueJsx
from
'
@vitejs/plugin-vue-jsx
'
function
resolve
(
file
:
string
)
{
return
path
.
resolve
(
__dirname
,
file
)
}
export
default
defineConfig
({
root
:
__dirname
,
resolve
:
{
alias
:
[
{
find
:
'
@dcloudio/uni-core
'
,
replacement
:
resolve
(
'
../uni-core/src
'
),
},
],
},
build
:
{
minify
:
false
,
lib
:
{
...
...
@@ -12,15 +25,17 @@ export default defineConfig({
formats
:
[
'
iife
'
],
},
rollupOptions
:
{
external
:
[
'
uni
'
,
'
vue
'
,
'
weex
'
],
external
:
[
'
uni
'
,
'
vue
'
,
'
weex
'
,
'
@vue/shared
'
],
output
:
{
banner
:
'
export function initComponents(uni, Vue, weex) {
'
,
banner
:
'
export function initComponents({uni,Vue,weex,plus,BroadcastChannel}) {
'
,
footer
:
'
return components
\n
}
'
,
entryFileNames
:
'
components.js
'
,
globals
:
{
uni
:
'
uni
'
,
vue
:
'
Vue
'
,
weex
:
'
weex
'
,
'
@vue/shared
'
:
'
VueShared
'
,
},
},
},
...
...
packages/uni-core/src/helpers/bridge.ts
浏览文件 @
1248259c
// TODO 等待 vue3 的兼容模式自带emitter
import
E
from
'
./TinyEmitter
'
export
function
initBridge
(
subscribeNamespace
:
'
service
'
|
'
view
'
subscribeNamespace
:
'
service
'
|
'
view
'
|
'
nvue
'
):
Omit
<
UniApp
.
UniServiceJSBridge
,
|
'
invokeOnCallback
'
...
...
@@ -10,7 +9,6 @@ export function initBridge(
|
'
invokeViewMethodKeepAlive
'
|
'
publishHandler
'
>
{
// TODO vue3 compatibility builds
const
emitter
=
new
E
()
return
{
on
(
event
:
string
,
callback
:
UniApp
.
CallbackFunction
)
{
...
...
packages/uni-core/src/index.ts
浏览文件 @
1248259c
...
...
@@ -3,3 +3,4 @@ export * from './view'
export
*
from
'
./service
'
export
*
from
'
./helpers
'
export
*
from
'
./constants
'
export
{
initBridge
}
from
'
./helpers/bridge
'
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录