Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MuGuiLin
uni-app
提交
c7b74ad1
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,发现更多精彩内容 >>
提交
c7b74ad1
编写于
3月 03, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(h5): picker i18n
上级
806ad9e4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
74 addition
and
25 deletion
+74
-25
src/core/helpers/i18n/en.json
src/core/helpers/i18n/en.json
+3
-1
src/core/helpers/i18n/es.json
src/core/helpers/i18n/es.json
+5
-3
src/core/helpers/i18n/fr.json
src/core/helpers/i18n/fr.json
+3
-1
src/core/helpers/i18n/index.js
src/core/helpers/i18n/index.js
+2
-1
src/core/helpers/i18n/zh-Hans.json
src/core/helpers/i18n/zh-Hans.json
+3
-1
src/core/helpers/i18n/zh-Hant.json
src/core/helpers/i18n/zh-Hant.json
+3
-1
src/platforms/h5/view/components/picker/index.vue
src/platforms/h5/view/components/picker/index.vue
+55
-17
未找到文件。
src/core/helpers/i18n/en.json
浏览文件 @
c7b74ad1
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
"uni.showLoading.unpaired"
:
"Please note showLoading must be paired with hideLoading"
,
"uni.showLoading.unpaired"
:
"Please note showLoading must be paired with hideLoading"
,
"uni.showModal.cancel"
:
"cancel"
,
"uni.showModal.cancel"
:
"cancel"
,
"uni.showModal.confirm"
:
"confirm"
,
"uni.showModal.confirm"
:
"confirm"
,
"uni.picker.done"
:
"Done"
,
"uni.picker.cancel"
:
"Cancel"
,
"uni.button.feedback.title"
:
"feedback"
,
"uni.button.feedback.title"
:
"feedback"
,
"uni.button.feedback.send"
:
"send"
"uni.button.feedback.send"
:
"send"
}
}
src/core/helpers/i18n/es.json
浏览文件 @
c7b74ad1
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
"uni.showToast.unpaired"
:
"Tenga en cuenta que showToast debe estar emparejado con hideToast"
,
"uni.showToast.unpaired"
:
"Tenga en cuenta que showToast debe estar emparejado con hideToast"
,
"uni.showLoading.unpaired"
:
"Tenga en cuenta que showLoading debe estar emparejado con hideLoading"
,
"uni.showLoading.unpaired"
:
"Tenga en cuenta que showLoading debe estar emparejado con hideLoading"
,
"uni.showModal.cancel"
:
"cancelar"
,
"uni.showModal.cancel"
:
"cancelar"
,
"uni.showModal.confirm"
:
"confirmar"
,
"uni.showModal.confirm"
:
"confirmar"
,
"uni.button.feedback.title"
:
"realimentación"
,
"uni.picker.done"
:
"OK"
,
"uni.picker.cancel"
:
"Cancelar"
,
"uni.button.feedback.title"
:
"realimentación"
,
"uni.button.feedback.send"
:
"enviar"
"uni.button.feedback.send"
:
"enviar"
}
}
src/core/helpers/i18n/fr.json
浏览文件 @
c7b74ad1
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
"uni.showLoading.unpaired"
:
"Veuillez noter que showLoading doit être associé à hideLoading"
,
"uni.showLoading.unpaired"
:
"Veuillez noter que showLoading doit être associé à hideLoading"
,
"uni.showModal.cancel"
:
"Annuler"
,
"uni.showModal.cancel"
:
"Annuler"
,
"uni.showModal.confirm"
:
"confirmer"
,
"uni.showModal.confirm"
:
"confirmer"
,
"uni.picker.done"
:
"OK"
,
"uni.picker.cancel"
:
"Annuler"
,
"uni.button.feedback.title"
:
"retour d'information"
,
"uni.button.feedback.title"
:
"retour d'information"
,
"uni.button.feedback.send"
:
"envoyer"
"uni.button.feedback.send"
:
"envoyer"
}
}
src/core/helpers/i18n/index.js
浏览文件 @
c7b74ad1
...
@@ -21,4 +21,5 @@ const fallbackLocale = 'en'
...
@@ -21,4 +21,5 @@ const fallbackLocale = 'en'
const
i18n
=
initVueI18n
(
__PLATFORM__
===
'
app-plus
'
||
__PLATFORM__
===
'
h5
'
?
messages
:
{},
fallbackLocale
)
const
i18n
=
initVueI18n
(
__PLATFORM__
===
'
app-plus
'
||
__PLATFORM__
===
'
h5
'
?
messages
:
{},
fallbackLocale
)
export
const
t
=
i18n
.
t
export
const
t
=
i18n
.
t
export
const
i18nMixin
=
i18n
.
mixin
export
const
i18nMixin
=
i18n
.
mixin
export
const
setLocale
=
i18n
.
setLocale
export
const
setLocale
=
i18n
.
setLocale
export
const
getLocale
=
i18n
.
getLocale
src/core/helpers/i18n/zh-Hans.json
浏览文件 @
c7b74ad1
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
"uni.showLoading.unpaired"
:
"请注意 showLoading 与 hideLoading 必须配对使用"
,
"uni.showLoading.unpaired"
:
"请注意 showLoading 与 hideLoading 必须配对使用"
,
"uni.showModal.cancel"
:
"取消"
,
"uni.showModal.cancel"
:
"取消"
,
"uni.showModal.confirm"
:
"确认"
,
"uni.showModal.confirm"
:
"确认"
,
"uni.picker.done"
:
"完成"
,
"uni.picker.cancel"
:
"取消"
,
"uni.button.feedback.title"
:
"问题反馈"
,
"uni.button.feedback.title"
:
"问题反馈"
,
"uni.button.feedback.send"
:
"发送"
"uni.button.feedback.send"
:
"发送"
}
}
src/core/helpers/i18n/zh-Hant.json
浏览文件 @
c7b74ad1
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
"uni.showLoading.unpaired"
:
"請注意 showLoading 與 hideLoading 必須配對使用"
,
"uni.showLoading.unpaired"
:
"請注意 showLoading 與 hideLoading 必須配對使用"
,
"uni.showModal.cancel"
:
"取消"
,
"uni.showModal.cancel"
:
"取消"
,
"uni.showModal.confirm"
:
"確認"
,
"uni.showModal.confirm"
:
"確認"
,
"uni.picker.done"
:
"完成"
,
"uni.picker.cancel"
:
"取消"
,
"uni.button.feedback.title"
:
"問題反饋"
,
"uni.button.feedback.title"
:
"問題反饋"
,
"uni.button.feedback.send"
:
"發送"
"uni.button.feedback.send"
:
"發送"
}
}
src/platforms/h5/view/components/picker/index.vue
浏览文件 @
c7b74ad1
...
@@ -33,22 +33,23 @@
...
@@ -33,22 +33,23 @@
class=
"uni-picker-action uni-picker-action-cancel"
class=
"uni-picker-action uni-picker-action-cancel"
@
click=
"_cancel"
@
click=
"_cancel"
>
>
取消
{{
$$t
(
"
uni.picker.cancel
"
)
}}
</div>
</div>
<div
<div
class=
"uni-picker-action uni-picker-action-confirm"
class=
"uni-picker-action uni-picker-action-confirm"
@
click=
"_change"
@
click=
"_change"
>
>
确定
{{
$$t
(
"
uni.picker.done
"
)
}}
</div>
</div>
</div>
</div>
<v-uni-picker-view
<v-uni-picker-view
v-if=
"contentVisible"
v-if=
"contentVisible"
:value
.sync=
"valueArray
"
:value
=
"_l10nColumn(valueArray)
"
class=
"uni-picker-content"
class=
"uni-picker-content"
@
change=
"_pickerViewChange"
>
>
<v-uni-picker-view-column
<v-uni-picker-view-column
v-for=
"(rangeItem, index0) in
rangeArray
"
v-for=
"(rangeItem, index0) in
_l10nColumn(rangeArray)
"
:key=
"index0"
:key=
"index0"
>
>
<div
<div
...
@@ -56,8 +57,7 @@
...
@@ -56,8 +57,7 @@
:key=
"index"
:key=
"index"
class=
"uni-picker-item"
class=
"uni-picker-item"
>
>
{{
typeof
item
===
"
object
"
?
item
[
rangeKey
]
||
""
:
item
{{
typeof
item
===
"
object
"
?
item
[
rangeKey
]
||
""
:
_l10nItem
(
item
,
index0
)
}}
}}{{
units
[
index0
]
||
""
}}
</div>
</div>
</v-uni-picker-view-column>
</v-uni-picker-view-column>
</v-uni-picker-view>
</v-uni-picker-view>
...
@@ -115,6 +115,10 @@ import { emitter } from 'uni-mixins'
...
@@ -115,6 +115,10 @@ import { emitter } from 'uni-mixins'
import
{
formatDateTime
}
from
'
uni-shared
'
import
{
formatDateTime
}
from
'
uni-shared
'
import
popup
from
'
../../../components/app/popup/mixins/popup
'
import
popup
from
'
../../../components/app/popup/mixins/popup
'
import
keypress
from
'
../../../helpers/keypress
'
import
keypress
from
'
../../../helpers/keypress
'
import
{
i18nMixin
,
getLocale
}
from
'
uni-core/helpers/i18n
'
function
getDefaultStartValue
()
{
function
getDefaultStartValue
()
{
if
(
this
.
mode
===
mode
.
TIME
)
{
if
(
this
.
mode
===
mode
.
TIME
)
{
...
@@ -172,7 +176,7 @@ const selectorType = {
...
@@ -172,7 +176,7 @@ const selectorType = {
export
default
{
export
default
{
name
:
'
Picker
'
,
name
:
'
Picker
'
,
components
:
{
keypress
},
components
:
{
keypress
},
mixins
:
[
emitter
,
popup
],
mixins
:
[
i18nMixin
,
emitter
,
popup
],
props
:
{
props
:
{
name
:
{
name
:
{
type
:
String
,
type
:
String
,
...
@@ -264,16 +268,6 @@ export default {
...
@@ -264,16 +268,6 @@ export default {
endArray
()
{
endArray
()
{
return
this
.
_getDateValueArray
(
this
.
end
,
getDefaultEndValue
.
bind
(
this
)())
return
this
.
_getDateValueArray
(
this
.
end
,
getDefaultEndValue
.
bind
(
this
)())
},
},
units
()
{
switch
(
this
.
mode
)
{
case
mode
.
DATE
:
return
[
'
年
'
,
'
月
'
,
'
日
'
]
case
mode
.
TIME
:
return
[
'
时
'
,
'
分
'
]
default
:
return
[]
}
},
selectorTypeComputed
()
{
selectorTypeComputed
()
{
const
type
=
this
.
selectorType
const
type
=
this
.
selectorType
if
(
Object
.
values
(
selectorType
).
includes
(
type
))
{
if
(
Object
.
values
(
selectorType
).
includes
(
type
))
{
...
@@ -610,6 +604,50 @@ export default {
...
@@ -610,6 +604,50 @@ export default {
style
.
left
=
`
${
$event
.
clientX
-
rect
.
left
-
fontSize
*
1.5
}
px`
style
.
left
=
`
${
$event
.
clientX
-
rect
.
left
-
fontSize
*
1.5
}
px`
style
.
top
=
`
${
$event
.
clientY
-
rect
.
top
-
fontSize
*
0.5
}
px`
style
.
top
=
`
${
$event
.
clientY
-
rect
.
top
-
fontSize
*
0.5
}
px`
}
}
},
_pickerViewChange
(
event
)
{
this
.
valueArray
==
this
.
_l10nColumn
(
event
.
detail
.
value
,
true
)
},
_l10nColumn
(
array
,
normalize
)
{
if
(
this
.
mode
===
mode
.
DATE
)
{
const
local
=
getLocale
()
if
(
!
local
.
startsWith
(
'
zh
'
))
{
switch
(
local
)
{
case
'
es
'
:
case
'
fr
'
:
return
[
array
[
2
],
array
[
1
],
array
[
0
]]
// case 'en':
default
:
return
normalize
?
[
array
[
2
],
array
[
0
],
array
[
1
]]
:
[
array
[
1
],
array
[
2
],
array
[
0
]]
}
}
}
return
array
},
_l10nItem
(
item
,
index
)
{
if
(
this
.
mode
===
mode
.
DATE
)
{
const
local
=
getLocale
()
if
(
local
.
startsWith
(
'
zh
'
))
{
const
array
=
[
'
年
'
,
'
月
'
,
'
日
'
]
return
item
+
array
[
index
]
}
else
if
(
index
===
(
local
===
'
es
'
||
local
===
'
fr
'
?
1
:
0
))
{
let
array
switch
(
local
)
{
case
'
es
'
:
array
=
[
'
enero
'
,
'
febrero
'
,
'
marzo
'
,
'
abril
'
,
'
mayo
'
,
'
junio
'
,
'
julio
'
,
'
agosto
'
,
'
septiembre
'
,
'
octubre
'
,
'
noviembre
'
,
'
diciembre
'
]
break
case
'
fr
'
:
array
=
[
'
janvier
'
,
'
février
'
,
'
mars
'
,
'
avril
'
,
'
mai
'
,
'
juin
'
,
'
juillet
'
,
'
août
'
,
'
septembre
'
,
'
octobre
'
,
'
novembre
'
,
'
décembre
'
]
break
// case 'en':
default
:
array
=
[
'
January
'
,
'
February
'
,
'
March
'
,
'
April
'
,
'
May
'
,
'
June
'
,
'
July
'
,
'
August
'
,
'
September
'
,
'
October
'
,
'
November
'
,
'
December
'
]
break
}
return
array
[
Number
(
item
)
-
1
]
}
}
return
item
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录