提交 d5a56eb6 编写于 作者: d-u-a's avatar d-u-a

fix(nvue3): label 及相关组件,progress 支持 borderRadius

上级 0538e72b
......@@ -58,4 +58,8 @@ export const progressProps = {
return !isNaN(parseFloat(value as string))
},
},
borderRadius: {
type: [Number, String],
default: 0,
},
}
......@@ -90,6 +90,7 @@ export default defineComponent({
}
if (isLabelClick) {
rootRef.value!.click()
return
}
checkboxChecked.value = !checkboxChecked.value
uniCheckGroup && uniCheckGroup.checkboxChange($event)
......
......@@ -4,9 +4,9 @@ import { labelProps, useProvideLabel } from '../../components/label'
export { UniLabelCtx, uniLabelKey } from '../../components/label'
type LabelTarget = HTMLElement & {
attr: { dataUncType: string }
}
// type LabelTarget = HTMLElement & {
// attr: { dataUncType: string }
// }
export default /*#__PURE__*/ defineComponent({
name: 'Label',
......@@ -17,15 +17,15 @@ export default /*#__PURE__*/ defineComponent({
const handlers = useProvideLabel()
const _onClick = ($event: Event) => {
const EventTarget = $event.target as LabelTarget
const dataType = EventTarget.attr.dataUncType || ''
let stopPropagation = /^uni-(checkbox|radio|switch)-/.test(dataType)
if (!stopPropagation) {
stopPropagation = /^uni-(checkbox|radio|switch|button)$/i.test(dataType)
}
if (stopPropagation) {
return
}
// const EventTarget = $event.target as LabelTarget
// const dataType = EventTarget.attr.dataUncType || ''
// let stopPropagation = /^uni-(checkbox|radio|switch)-/.test(dataType)
// if (!stopPropagation) {
// stopPropagation = /^uni-(checkbox|radio|switch|button)$/i.test(dataType)
// }
// if (stopPropagation) {
// return
// }
if (props.for) {
UniViewJSBridge.emit(
......
......@@ -108,6 +108,7 @@ function useProgressState(props: ProgressProps) {
const outerBarStyle = computed(() => ({
backgroundColor: props.backgroundColor,
borderRadius: props.borderRadius,
height: props.strokeWidth,
}))
const innerBarStyle = computed(() => {
......@@ -122,6 +123,7 @@ function useProgressState(props: ProgressProps) {
width: (currentPercent.value * progressWidth.value) / 100,
height: props.strokeWidth,
backgroundColor: backgroundColor,
borderRadius: props.borderRadius,
}
})
const realPercent = computed(() => {
......
......@@ -102,6 +102,7 @@ export default defineComponent({
}
if (isLabelClick) {
rootRef.value!.click()
return
}
radioChecked.value = !radioChecked.value
uniCheckGroup && uniCheckGroup.radioChange($event, field)
......
......@@ -97,14 +97,13 @@ const slierStyles: NVueComponentStyles = [
width: 100,
height: '2',
background: 'transparent',
zIndex: 1,
},
},
'uni-slider-value': {
'': {
color: '#888888',
fontSize: '14',
marginRight: '14',
marginLeft: '14',
},
},
},
......@@ -159,7 +158,7 @@ export default defineComponent({
<div class="uni-slider-thumb" style={thumbStyle}></div>
</div>
{showValue
? createNVueTextVNode(sliderValue as unknown as string, {
? createNVueTextVNode(sliderValue + '', {
class: 'uni-slider-value',
})
: null}
......
......@@ -52,10 +52,14 @@ export default defineComponent({
},
}
const _onClick = ($event: Event) => {
const _onClick = ($event: Event, isLabelClick?: boolean) => {
if (props.disabled) {
return
}
if (isLabelClick) {
rootRef.value!.click()
return
}
switchChecked.value = !switchChecked.value
trigger('change', {
value: switchChecked.value,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册