Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yangkaifeng
uni-app
提交
a4ba298b
U
uni-app
项目概览
yangkaifeng
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
3
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,发现更多精彩内容 >>
提交
a4ba298b
编写于
5月 14, 2021
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: picker value sync
上级
ffe97aa2
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
181 addition
and
133 deletion
+181
-133
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+60
-46
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+66
-44
packages/uni-h5/src/view/components/picker/index.vue
packages/uni-h5/src/view/components/picker/index.vue
+55
-43
未找到文件。
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
a4ba298b
...
...
@@ -1704,11 +1704,11 @@ function useResizeSensorUpdate(rootRef, emit2, reset) {
vue
.
watch
(()
=>
shared
.
extend
({},
size
),
(
value
)
=>
emit2
(
"
resize
"
,
value
));
return
()
=>
{
const
{
offsetW
idth
,
offsetH
eight
}
=
rootRef
.
value
;
size
.
width
=
offsetW
idth
;
size
.
height
=
offsetH
eight
;
w
idth
,
h
eight
}
=
rootRef
.
value
.
getBoundingClientRect
()
;
size
.
width
=
w
idth
;
size
.
height
=
h
eight
;
reset
();
};
}
...
...
@@ -4601,6 +4601,7 @@ var PickerView = /* @__PURE__ */ defineBuiltInComponent({
const
rootRef
=
vue
.
ref
(
null
);
const
trigger
=
useCustomEvent
(
rootRef
,
emit2
);
const
state
=
useState$1
(
props2
);
const
resizeSensorRef
=
vue
.
ref
(
null
);
let
columnVNodes
=
[];
function
getItemIndex
(
vnode
)
{
return
columnVNodes
.
indexOf
(
vnode
);
...
...
@@ -4635,11 +4636,11 @@ var PickerView = /* @__PURE__ */ defineBuiltInComponent({
return
vue
.
createVNode
(
"
uni-picker-view
"
,
{
"
ref
"
:
rootRef
},
[
vue
.
createVNode
(
ResizeSensor
,
{
"
initial
"
:
true
,
"
ref
"
:
resizeSensorRef
,
"
onResize
"
:
({
height
})
=>
state
.
height
=
height
},
null
,
8
,
[
"
initial
"
,
"
onResize
"
]),
vue
.
createVNode
(
"
div
"
,
{
},
null
,
8
,
[
"
onResize
"
]),
vue
.
createVNode
(
"
div
"
,
{
"
class
"
:
"
uni-picker-view-wrapper
"
},
[
defaultSlots
])],
512
);
};
...
...
@@ -5350,6 +5351,7 @@ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
const
pickerViewProps
=
vue
.
inject
(
"
pickerViewProps
"
);
const
pickerViewState
=
vue
.
inject
(
"
pickerViewState
"
);
const
indicatorHeight
=
vue
.
ref
(
34
);
const
resizeSensorRef
=
vue
.
ref
(
null
);
const
maskSize
=
vue
.
computed
(()
=>
(
pickerViewState
.
height
-
indicatorHeight
.
value
)
/
2
);
const
{
state
:
scopedAttrsState
...
...
@@ -5416,11 +5418,11 @@ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
"
class
"
:
[
"
uni-picker-view-indicator
"
,
pickerViewProps
.
indicatorClass
],
"
style
"
:
pickerViewProps
.
indicatorStyle
}),
[
vue
.
createVNode
(
ResizeSensor
,
{
"
initial
"
:
true
,
"
ref
"
:
resizeSensorRef
,
"
onResize
"
:
({
height
})
=>
indicatorHeight
.
value
=
height
},
null
,
8
,
[
"
initial
"
,
"
onResize
"
])],
16
),
vue
.
createVNode
(
"
div
"
,
{
},
null
,
8
,
[
"
onResize
"
])],
16
),
vue
.
createVNode
(
"
div
"
,
{
"
ref
"
:
contentRef
,
"
class
"
:
[
"
uni-picker-view-content
"
,
className
],
"
style
"
:
{
...
...
@@ -10174,19 +10176,30 @@ var _sfc_main$1 = {
},
300
);
}
},
value
()
{
value
:
{
deep
:
true
,
handler
()
{
this
.
_setValueSync
();
}
},
mode
()
{
this
.
_setValueSync
();
},
range
()
{
range
:
{
deep
:
true
,
handler
()
{
this
.
_setValueSync
();
}
},
valueSync
()
{
valueSync
:
{
deep
:
true
,
handler
()
{
this
.
_setValueArray
();
}
},
valueArray
(
val
)
{
valueArray
:
{
deep
:
true
,
handler
(
val
)
{
if
(
this
.
mode
===
mode
.
TIME
||
this
.
mode
===
mode
.
DATE
)
{
const
getValue
=
this
.
mode
===
mode
.
TIME
?
this
.
_getTimeValue
:
this
.
_getDateValue
;
const
valueArray
=
this
.
valueArray
;
...
...
@@ -10219,6 +10232,7 @@ var _sfc_main$1 = {
}
});
}
}
},
created
()
{
initI18nPickerMsgsOnce
();
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
a4ba298b
...
...
@@ -5368,11 +5368,11 @@ function useResizeSensorUpdate(rootRef, emit2, reset) {
watch(() => extend({}, size), (value) => emit2("resize", value));
return () => {
const {
offsetW
idth,
offsetH
eight
} = rootRef.value;
size.width =
offsetW
idth;
size.height =
offsetH
eight;
w
idth,
h
eight
} = rootRef.value
.getBoundingClientRect()
;
size.width =
w
idth;
size.height =
h
eight;
reset();
};
}
...
...
@@ -9353,6 +9353,11 @@ var PickerView = /* @__PURE__ */ defineBuiltInComponent({
const rootRef = ref(null);
const trigger = useCustomEvent(rootRef, emit2);
const state2 = useState$2(props2);
const resizeSensorRef = ref(null);
onMounted(() => {
const resizeSensor = resizeSensorRef.value;
state2.height = resizeSensor.$el.getBoundingClientRect().height;
});
let columnVNodes = [];
function getItemIndex(vnode) {
return columnVNodes.indexOf(vnode);
...
...
@@ -9387,11 +9392,11 @@ var PickerView = /* @__PURE__ */ defineBuiltInComponent({
return createVNode("uni-picker-view", {
"ref": rootRef
}, [createVNode(ResizeSensor, {
"
initial": true
,
"
ref": resizeSensorRef
,
"onResize": ({
height
}) => state2.height = height
}, null, 8, ["
initial", "
onResize"]), createVNode("div", {
}, null, 8, ["onResize"]), createVNode("div", {
"class": "uni-picker-view-wrapper"
}, [defaultSlots])], 512);
};
...
...
@@ -10129,6 +10134,11 @@ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
const pickerViewProps = inject("pickerViewProps");
const pickerViewState = inject("pickerViewState");
const indicatorHeight = ref(34);
const resizeSensorRef = ref(null);
onMounted(() => {
const resizeSensor = resizeSensorRef.value;
indicatorHeight.value = resizeSensor.$el.getBoundingClientRect().height;
});
const maskSize = computed(() => (pickerViewState.height - indicatorHeight.value) / 2);
const {
state: scopedAttrsState
...
...
@@ -10241,11 +10251,11 @@ var PickerViewColumn = /* @__PURE__ */ defineBuiltInComponent({
"class": ["uni-picker-view-indicator", pickerViewProps.indicatorClass],
"style": pickerViewProps.indicatorStyle
}), [createVNode(ResizeSensor, {
"
initial": true
,
"
ref": resizeSensorRef
,
"onResize": ({
height
}) => indicatorHeight.value = height
}, null, 8, ["
initial", "
onResize"])], 16), createVNode("div", {
}, null, 8, ["onResize"])], 16), createVNode("div", {
"ref": contentRef,
"class": ["uni-picker-view-content", className],
"style": {
...
...
@@ -18530,19 +18540,30 @@ var _sfc_main$1 = {
}, 300);
}
},
value() {
value: {
deep: true,
handler() {
this._setValueSync();
}
},
mode() {
this._setValueSync();
},
range() {
range: {
deep: true,
handler() {
this._setValueSync();
}
},
valueSync() {
valueSync: {
deep: true,
handler() {
this._setValueArray();
}
},
valueArray(val) {
valueArray: {
deep: true,
handler(val) {
if (this.mode === mode.TIME || this.mode === mode.DATE) {
const getValue = this.mode === mode.TIME ? this._getTimeValue : this._getDateValue;
const valueArray = this.valueArray;
...
...
@@ -18575,6 +18596,7 @@ var _sfc_main$1 = {
}
});
}
}
},
created() {
initI18nPickerMsgsOnce();
...
...
packages/uni-h5/src/view/components/picker/index.vue
浏览文件 @
a4ba298b
...
...
@@ -301,19 +301,30 @@ export default {
},
300
);
}
},
value
()
{
value
:
{
deep
:
true
,
handler
()
{
this
.
_setValueSync
();
}
},
mode
()
{
this
.
_setValueSync
();
},
range
()
{
range
:
{
deep
:
true
,
handler
()
{
this
.
_setValueSync
();
}
},
valueSync
()
{
valueSync
:
{
deep
:
true
,
handler
()
{
this
.
_setValueArray
();
}
},
valueArray
(
val
)
{
valueArray
:
{
deep
:
true
,
handler
(
val
)
{
if
(
this
.
mode
===
mode
.
TIME
||
this
.
mode
===
mode
.
DATE
)
{
const
getValue
=
this
.
mode
===
mode
.
TIME
?
this
.
_getTimeValue
:
this
.
_getDateValue
;
...
...
@@ -352,6 +363,7 @@ export default {
}
}
});
}
},
},
created
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录