Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
cbb3621a
U
uni-app
项目概览
Velpro187
/
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,发现更多精彩内容 >>
提交
cbb3621a
编写于
5月 21, 2021
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: cover-image、cover-view、navigator
上级
98622ff5
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
738 addition
and
772 deletion
+738
-772
packages/uni-components/src/components/index.ts
packages/uni-components/src/components/index.ts
+1
-1
packages/uni-components/src/components/navigator/index.tsx
packages/uni-components/src/components/navigator/index.tsx
+114
-0
packages/uni-components/src/components/navigator/index.vue
packages/uni-components/src/components/navigator/index.vue
+0
-113
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+255
-277
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+262
-281
packages/uni-h5/src/service/api/route/redirectTo.ts
packages/uni-h5/src/service/api/route/redirectTo.ts
+1
-0
packages/uni-h5/src/view/components/cover-image/index.tsx
packages/uni-h5/src/view/components/cover-image/index.tsx
+43
-0
packages/uni-h5/src/view/components/cover-image/index.vue
packages/uni-h5/src/view/components/cover-image/index.vue
+0
-44
packages/uni-h5/src/view/components/cover-view/index.tsx
packages/uni-h5/src/view/components/cover-view/index.tsx
+60
-0
packages/uni-h5/src/view/components/cover-view/index.vue
packages/uni-h5/src/view/components/cover-view/index.vue
+0
-54
packages/uni-h5/src/view/components/index.ts
packages/uni-h5/src/view/components/index.ts
+2
-2
未找到文件。
packages/uni-components/src/components/index.ts
浏览文件 @
cbb3621a
...
@@ -11,7 +11,7 @@ import Input from './input/index'
...
@@ -11,7 +11,7 @@ import Input from './input/index'
import
Label
from
'
./label/index
'
import
Label
from
'
./label/index
'
import
MovableArea
from
'
./movable-area/index
'
import
MovableArea
from
'
./movable-area/index
'
import
MovableView
from
'
./movable-view/index
'
import
MovableView
from
'
./movable-view/index
'
import
Navigator
from
'
./navigator
/index.vue
'
import
Navigator
from
'
./navigator
'
import
PickerView
from
'
./picker-view/index
'
import
PickerView
from
'
./picker-view/index
'
import
PickerViewColumn
from
'
./picker-view-column/index
'
import
PickerViewColumn
from
'
./picker-view-column/index
'
import
Progress
from
'
./progress/index
'
import
Progress
from
'
./progress/index
'
...
...
packages/uni-components/src/components/navigator/index.tsx
0 → 100644
浏览文件 @
cbb3621a
import
{
useHover
}
from
'
../../helpers/useHover
'
import
{
defineBuiltInComponent
}
from
'
@dcloudio/uni-components
'
const
OPEN_TYPES
=
[
'
navigate
'
,
'
redirect
'
,
'
switchTab
'
,
'
reLaunch
'
,
'
navigateBack
'
,
]
const
props
=
{
hoverClass
:
{
type
:
String
,
default
:
'
navigator-hover
'
,
},
url
:
{
type
:
String
,
default
:
''
,
},
openType
:
{
type
:
String
,
default
:
'
navigate
'
,
validator
(
value
:
unknown
)
{
return
Boolean
(
~
OPEN_TYPES
.
indexOf
(
value
as
string
))
},
},
delta
:
{
type
:
Number
,
default
:
1
,
},
hoverStartTime
:
{
type
:
[
Number
,
String
],
default
:
50
,
},
hoverStayTime
:
{
type
:
[
Number
,
String
],
default
:
600
,
},
exists
:
{
type
:
String
,
default
:
''
,
},
hoverStopPropagation
:
{
type
:
Boolean
,
default
:
false
,
},
}
export
default
/*#__PURE__*/
defineBuiltInComponent
({
name
:
'
Navigator
'
,
compatConfig
:
{
MODE
:
3
,
},
props
,
setup
(
props
,
{
slots
})
{
const
{
hovering
,
binding
}
=
useHover
(
props
)
function
onClick
(
$event
:
MouseEvent
)
{
if
(
props
.
openType
!==
'
navigateBack
'
&&
!
props
.
url
)
{
console
.
error
(
'
<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab
'
)
return
}
switch
(
props
.
openType
)
{
case
'
navigate
'
:
uni
.
navigateTo
({
url
:
props
.
url
,
})
break
case
'
redirect
'
:
uni
.
redirectTo
({
url
:
props
.
url
,
// @ts-ignore
exists
:
props
.
exists
,
})
break
case
'
switchTab
'
:
uni
.
switchTab
({
url
:
props
.
url
,
})
break
case
'
reLaunch
'
:
uni
.
reLaunch
({
url
:
props
.
url
,
})
break
case
'
navigateBack
'
:
uni
.
navigateBack
({
delta
:
props
.
delta
,
})
break
default
:
break
}
}
return
()
=>
{
const
{
hoverClass
}
=
props
const
hasHoverClass
=
props
.
hoverClass
&&
props
.
hoverClass
!==
'
none
'
return
(
<
uni
-
navigator
class
=
{
hasHoverClass
&&
hovering
.
value
?
hoverClass
:
''
}
{
...(
hasHoverClass
&&
binding
)
}
onClick
=
{
onClick
}
>
{
slots
.
default
&&
slots
.
default
()
}
</
uni
-
navigator
>
)
}
},
})
packages/uni-components/src/components/navigator/index.vue
已删除
100644 → 0
浏览文件 @
98622ff5
<
template
>
<uni-navigator
v-if=
"hoverClass && hoverClass !== 'none'"
:class=
"[hovering ? hoverClass : '']"
v-bind=
"binding"
@
click=
"_onClick"
>
<slot
/>
</uni-navigator>
<uni-navigator
v-else
@
click=
"_onClick"
>
<slot
/>
</uni-navigator>
</
template
>
<
script
>
import
{
useHover
}
from
"
../../helpers/useHover
"
;
const
OPEN_TYPES
=
[
"
navigate
"
,
"
redirect
"
,
"
switchTab
"
,
"
reLaunch
"
,
"
navigateBack
"
];
export
default
{
name
:
"
Navigator
"
,
compatConfig
:
{
MODE
:
3
},
props
:
{
hoverClass
:
{
type
:
String
,
default
:
"
navigator-hover
"
,
},
url
:
{
type
:
String
,
default
:
""
,
},
openType
:
{
type
:
String
,
default
:
"
navigate
"
,
validator
(
value
)
{
return
~
OPEN_TYPES
.
indexOf
(
value
);
},
},
delta
:
{
type
:
Number
,
default
:
1
,
},
hoverStartTime
:
{
type
:
[
Number
,
String
],
default
:
50
,
},
hoverStayTime
:
{
type
:
[
Number
,
String
],
default
:
600
,
},
exists
:
{
type
:
String
,
default
:
""
,
},
hoverStopPropagation
:
{
type
:
Boolean
,
default
:
false
,
},
},
methods
:
{
_onClick
(
$event
)
{
if
(
this
.
openType
!==
"
navigateBack
"
&&
!
this
.
url
)
{
console
.
error
(
"
<navigator/> should have url attribute when using navigateTo, redirectTo, reLaunch or switchTab
"
);
return
;
}
switch
(
this
.
openType
)
{
case
"
navigate
"
:
uni
.
navigateTo
({
url
:
this
.
url
,
});
break
;
case
"
redirect
"
:
uni
.
redirectTo
({
url
:
this
.
url
,
exists
:
this
.
exists
,
});
break
;
case
"
switchTab
"
:
uni
.
switchTab
({
url
:
this
.
url
,
});
break
;
case
"
reLaunch
"
:
uni
.
reLaunch
({
url
:
this
.
url
,
});
break
;
case
"
navigateBack
"
:
uni
.
navigateBack
({
delta
:
this
.
delta
,
});
break
;
default
:
break
;
}
},
},
setup
(
props
)
{
const
{
hovering
,
binding
}
=
useHover
(
props
);
return
{
hovering
,
binding
,
};
},
};
</
script
>
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
cbb3621a
此差异已折叠。
点击以展开。
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
cbb3621a
此差异已折叠。
点击以展开。
packages/uni-h5/src/service/api/route/redirectTo.ts
浏览文件 @
cbb3621a
...
@@ -22,6 +22,7 @@ export const redirectTo = defineAsyncApi<API_TYPE_REDIRECT_TO>(
...
@@ -22,6 +22,7 @@ export const redirectTo = defineAsyncApi<API_TYPE_REDIRECT_TO>(
API_REDIRECT_TO
,
API_REDIRECT_TO
,
({
url
},
{
resolve
,
reject
})
=>
{
({
url
},
{
resolve
,
reject
})
=>
{
return
(
return
(
// TODO exists 属性未实现
removeLastPage
(),
removeLastPage
(),
navigate
(
API_REDIRECT_TO
,
url
).
then
(
resolve
).
catch
(
reject
)
navigate
(
API_REDIRECT_TO
,
url
).
then
(
resolve
).
catch
(
reject
)
)
)
...
...
packages/uni-h5/src/view/components/cover-image/index.tsx
0 → 100644
浏览文件 @
cbb3621a
import
{
ref
}
from
'
vue
'
import
{
getRealPath
}
from
'
@dcloudio/uni-platform
'
import
{
useCustomEvent
,
EmitEvent
}
from
'
@dcloudio/uni-components
'
import
{
defineBuiltInComponent
}
from
'
@dcloudio/uni-components
'
export
default
/*#__PURE__*/
defineBuiltInComponent
({
name
:
'
CoverImage
'
,
compatConfig
:
{
MODE
:
3
,
},
props
:
{
src
:
{
type
:
String
,
default
:
''
,
},
},
emits
:
[
'
load
'
,
'
error
'
],
setup
(
props
,
{
emit
})
{
const
root
=
ref
(
null
)
const
trigger
=
useCustomEvent
<
EmitEvent
<
typeof
emit
>>
(
root
,
emit
)
function
load
(
$event
:
Event
)
{
trigger
(
'
load
'
,
$event
)
}
function
error
(
$event
:
Event
)
{
trigger
(
'
error
'
,
$event
)
}
return
()
=>
{
const
{
src
}
=
props
return
(
<
uni
-
cover
-
image
ref
=
{
root
}
src
=
{
src
}
>
<
div
class
=
"uni-cover-image"
>
{
src
?
(
<
img
src
=
{
getRealPath
(
src
)
}
onLoad
=
{
load
}
onError
=
{
error
}
/>
)
:
null
}
</
div
>
</
uni
-
cover
-
image
>
)
}
},
})
packages/uni-h5/src/view/components/cover-image/index.vue
已删除
100644 → 0
浏览文件 @
98622ff5
<
template
>
<uni-cover-image
ref=
"root"
:src=
"src"
>
<div
class=
"uni-cover-image"
>
<img
v-if=
"src"
:src=
"getRealPath(src)"
@
load=
"_load"
@
error=
"_error"
/>
</div>
</uni-cover-image>
</
template
>
<
script
>
import
{
ref
}
from
"
vue
"
;
import
{
getRealPath
}
from
"
@dcloudio/uni-platform
"
;
import
{
useCustomEvent
}
from
"
@dcloudio/uni-components
"
;
export
default
{
name
:
"
CoverImage
"
,
compatConfig
:
{
MODE
:
3
},
props
:
{
src
:
{
type
:
String
,
default
:
""
,
},
},
methods
:
{
getRealPath
,
_load
(
$event
)
{
this
.
$trigger
(
"
load
"
,
$event
);
},
_error
(
$event
)
{
this
.
$trigger
(
"
error
"
,
$event
);
},
},
mounted
()
{
this
.
$trigger
=
useCustomEvent
({
value
:
this
.
root
},
this
.
$emit
);
},
setup
()
{
const
root
=
ref
(
null
);
return
{
root
,
};
},
};
</
script
>
packages/uni-h5/src/view/components/cover-view/index.tsx
0 → 100644
浏览文件 @
cbb3621a
import
{
ref
,
ExtractPropTypes
,
watch
,
onMounted
}
from
'
vue
'
import
{
defineBuiltInComponent
}
from
'
@dcloudio/uni-components
'
const
props
=
{
scrollTop
:
{
type
:
[
String
,
Number
],
default
:
0
,
},
}
type
Props
=
ExtractPropTypes
<
typeof
props
>
export
default
/*#__PURE__*/
defineBuiltInComponent
({
name
:
'
CoverView
'
,
compatConfig
:
{
MODE
:
3
,
},
props
,
setup
(
props
,
{
slots
})
{
const
content
=
ref
<
HTMLElement
|
null
>
(
null
)
watch
(
()
=>
props
.
scrollTop
,
(
val
)
=>
{
setScrollTop
(
val
)
}
)
function
setScrollTop
(
val
:
Props
[
'
scrollTop
'
])
{
let
_content
=
content
.
value
!
if
(
getComputedStyle
(
_content
).
overflowY
===
'
scroll
'
)
{
_content
.
scrollTop
=
_upx2pxNum
(
val
)
}
}
function
_upx2pxNum
(
val
:
Props
[
'
scrollTop
'
])
{
let
_val
=
String
(
val
)
if
(
/
\d
+
[
ur
]
px$/i
.
test
(
_val
))
{
_val
.
replace
(
/
\d
+
[
ur
]
px$/i
,
(
text
)
=>
{
return
String
(
uni
.
upx2px
(
parseFloat
(
text
)))
})
}
return
parseFloat
(
_val
)
||
0
}
onMounted
(()
=>
{
setScrollTop
(
props
.
scrollTop
)
})
return
()
=>
{
return
(
<
uni
-
cover
-
view
scroll
-
top
=
{
props
.
scrollTop
}
>
<
div
ref
=
{
content
}
class
=
"uni-cover-view"
>
{
slots
.
default
&&
slots
.
default
()
}
</
div
>
</
uni
-
cover
-
view
>
)
}
},
})
packages/uni-h5/src/view/components/cover-view/index.vue
已删除
100644 → 0
浏览文件 @
98622ff5
<
template
>
<uni-cover-view
:scroll-top=
"scrollTop"
>
<div
ref=
"content"
class=
"uni-cover-view"
>
<slot
/>
</div>
</uni-cover-view>
</
template
>
<
script
>
import
{
ref
}
from
"
vue
"
;
export
default
{
name
:
"
CoverView
"
,
compatConfig
:
{
MODE
:
3
},
props
:
{
scrollTop
:
{
type
:
[
String
,
Number
],
default
:
0
,
},
},
watch
:
{
scrollTop
(
val
)
{
this
.
setScrollTop
(
val
);
},
},
mounted
()
{
this
.
setScrollTop
(
this
.
scrollTop
);
},
methods
:
{
setScrollTop
(
val
)
{
var
content
=
this
.
content
;
if
(
getComputedStyle
(
content
).
overflowY
===
"
scroll
"
)
{
content
.
scrollTop
=
this
.
_upx2pxNum
(
val
);
}
},
_upx2pxNum
(
val
)
{
if
(
/
\d
+
[
ur
]
px$/i
.
test
(
val
))
{
val
.
replace
(
/
\d
+
[
ur
]
px$/i
,
(
text
)
=>
{
return
uni
.
upx2px
(
parseFloat
(
text
));
});
}
return
parseFloat
(
val
)
||
0
;
},
},
setup
()
{
const
content
=
ref
(
null
);
return
{
content
,
};
},
};
</
script
>
\ No newline at end of file
packages/uni-h5/src/view/components/index.ts
浏览文件 @
cbb3621a
import
Video
from
'
./video/index
'
import
Video
from
'
./video/index
'
import
WebView
from
'
./web-view/index
'
import
WebView
from
'
./web-view/index
'
import
Map
from
'
./map/index
'
import
Map
from
'
./map/index
'
import
CoverView
from
'
./cover-view
/index.vue
'
import
CoverView
from
'
./cover-view
'
import
CoverImage
from
'
./cover-image
/index.vue
'
import
CoverImage
from
'
./cover-image
'
import
Picker
from
'
./picker/index.vue
'
import
Picker
from
'
./picker/index.vue
'
export
{
Video
,
WebView
,
Map
,
CoverView
,
CoverImage
,
Picker
}
export
{
Video
,
WebView
,
Map
,
CoverView
,
CoverImage
,
Picker
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录