Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/Tencent/tdesign-mobile-vue
Browse files Browse the repository at this point in the history
… into fix/picker-columns
  • Loading branch information
hkaikai committed Dec 8, 2023
2 parents 77a107e + 4c85efd commit a02311b
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/dropdown-menu/dropdown-item-props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ export default {
},
/** 选中值 */
value: {
type: [String, Number] as PropType<TdDropdownItemProps['value']>,
type: [String, Number, Array] as PropType<TdDropdownItemProps['value']>,
default: undefined,
},
modelValue: {
type: [String, Number] as PropType<TdDropdownItemProps['value']>,
type: [String, Number, Array] as PropType<TdDropdownItemProps['value']>,
default: undefined,
},
/** 选中值,非受控属性 */
defaultValue: {
type: [String, Number] as PropType<TdDropdownItemProps['defaultValue']>,
type: [String, Number, Array] as PropType<TdDropdownItemProps['defaultValue']>,
default: undefined,
},
/** 值改变时触发 */
Expand Down
4 changes: 2 additions & 2 deletions src/dropdown-menu/dropdown-menu.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ label | String | - | \- | N
multiple | Boolean | false | \- | N
options | Array | [] | Typescript:`Array<DropdownOption>` `interface DropdownOption { label: string; disabled: boolean; value: DropdownValue; }`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
optionsColumns | String / Number | 1 | \- | N
value | String / Number | undefined | `v-model` and `v-model:value` is supported。Typescript:`DropdownValue ` `type DropdownValue = string \| number;`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
defaultValue | String / Number | undefined | uncontrolled property。Typescript:`DropdownValue ` `type DropdownValue = string \| number;`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
value | String / Number / Array | undefined | `v-model` and `v-model:value` is supported。Typescript:`DropdownValue ` `type DropdownValue = string \| number \| Array<DropdownValue>;`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
defaultValue | String / Number / Array | undefined | uncontrolled property。Typescript:`DropdownValue ` `type DropdownValue = string \| number \| Array<DropdownValue>;`[see more ts definition](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
onChange | Function | | Typescript:`(value: DropdownValue) => void`<br/> | N
onConfirm | Function | | Typescript:`(value: DropdownValue) => void`<br/> | N
onReset | Function | | Typescript:`(value: DropdownValue) => void`<br/> | N
Expand Down
4 changes: 2 additions & 2 deletions src/dropdown-menu/dropdown-menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ label | String | - | 标题 | N
multiple | Boolean | false | 是否多选 | N
options | Array | [] | 选项数据。TS 类型:`Array<DropdownOption>` `interface DropdownOption { label: string; disabled: boolean; value: DropdownValue; }`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
optionsColumns | String / Number | 1 | 选项分栏(1-3) | N
value | String / Number | undefined | 选中值。支持语法糖 `v-model``v-model:value`。TS 类型:`DropdownValue ` `type DropdownValue = string \| number;`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
defaultValue | String / Number | undefined | 选中值。非受控属性。TS 类型:`DropdownValue ` `type DropdownValue = string \| number;`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
value | String / Number / Array | undefined | 选中值。支持语法糖 `v-model``v-model:value`。TS 类型:`DropdownValue ` `type DropdownValue = string \| number \| Array<DropdownValue>;`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
defaultValue | String / Number / Array | undefined | 选中值。非受控属性。TS 类型:`DropdownValue ` `type DropdownValue = string \| number \| Array<DropdownValue>;`[详细类型定义](https://github.com/Tencent/tdesign-mobile-vue/tree/develop/src/dropdown-menu/type.ts) | N
onChange | Function | | TS 类型:`(value: DropdownValue) => void`<br/>值改变时触发 | N
onConfirm | Function | | TS 类型:`(value: DropdownValue) => void`<br/>点击确认时触发 | N
onReset | Function | | TS 类型:`(value: DropdownValue) => void`<br/>点击重置时触发 | N
Expand Down
2 changes: 1 addition & 1 deletion src/dropdown-menu/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ export interface DropdownOption {
value: DropdownValue;
}

export type DropdownValue = string | number;
export type DropdownValue = string | number | Array<DropdownValue>;
4 changes: 2 additions & 2 deletions src/slider/demos/label.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import { ref } from 'vue';
const value = ref(10);
const onChange = (e: any) => {
value.value = e.value;
const onChange = (e: number) => {
value.value = e;
};
</script>

Expand Down
4 changes: 4 additions & 0 deletions src/tabs/tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import {
Fragment,
watch,
CSSProperties,
onActivated,
} from 'vue';
import config from '../config';
import TabsProps from './props';
Expand Down Expand Up @@ -175,6 +176,9 @@ export default defineComponent({
onBeforeUnmount(() => {
window.removeEventListener('resize', moveToActiveTab);
});
onActivated(() => {
moveToActiveTab();
});
watch(value, () => {
nextTick(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/textarea/demos/card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
class="textarea"
label="标签文字"
placeholder="请输入文字"
maxlength="500"
:maxlength="500"
indicator
layout="vertical"
/>
</div>

<div class="textarea-example card">
<div class="textarea-example__summary">卡片样式</div>
<t-textarea class="textarea" label="标签文字" placeholder="请输入文字" maxlength="500" indicator />
<t-textarea class="textarea" label="标签文字" placeholder="请输入文字" :maxlength="500" indicator />
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion src/textarea/demos/custom.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="textarea-example">
<text class="textarea-example__label">标签文字</text>
<t-textarea class="textarea" placeholder="请输入文字" bordered maxlength="100" indicator style="{{style}}" />
<t-textarea class="textarea" placeholder="请输入文字" bordered :maxlength="100" indicator style="{{style}}" />
</div>
</template>

Expand Down
9 changes: 8 additions & 1 deletion src/textarea/textarea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export default defineComponent({
const textareaLength = ref(0);
const { value, modelValue } = toRefs(props);
const [innerValue, setInnerValue] = useVModel(value, modelValue, props.defaultValue, props.onChange);
const textareaClass = computed(() => [
`${componentName}`,
{
Expand Down Expand Up @@ -85,6 +84,8 @@ export default defineComponent({
const adjustTextareaHeight = () => {
if (props.autosize === true) {
textareaStyle.value = calcTextareaHeight(textareaRef.value as HTMLTextAreaElement);
} else if (props.autosize === false) {
textareaStyle.value = calcTextareaHeight(textareaRef.value as HTMLTextAreaElement, 1, 1);
} else if (typeof props.autosize === 'object') {
const { minRows, maxRows } = props.autosize;
textareaStyle.value = calcTextareaHeight(textareaRef.value as HTMLTextAreaElement, minRows, maxRows);
Expand Down Expand Up @@ -144,6 +145,12 @@ export default defineComponent({
adjustTextareaHeight();
});
});
watch(
() => props.autosize,
() => {
adjustTextareaHeight();
},
);
return {
componentName,
...toRefs(props),
Expand Down

0 comments on commit a02311b

Please sign in to comment.