Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(swiper): add dots and dots-bar style #1498

Merged
merged 5 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion examples/swiper/usage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
<base-usage :code="usageCode" :config-list="configList" :panel-list="panelList" @PanelChange="onPanelChange">
<template #swiper="{ configProps }"
><div :style="{ width: '500px' }">
<t-swiper :duration="300" :interval="2000" v-bind="configProps">
<t-swiper
:duration="300"
:interval="2000"
v-bind="configProps"
:navigation="{ type: configProps.navigationType }"
>
<t-swiper-item>
<div :style="{ height: '200px', background: 'var(--td-success-color-7)' }" />
</t-swiper-item>
Expand Down
19 changes: 19 additions & 0 deletions examples/swiper/usage/props.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,24 @@
"value": "card"
}
]
},
{
"name": "navigationType",
"type": "enum",
"defaultValue": "bars",
"options": [
{
"label": "bars",
"value": "bars"
},
{
"label": "dots",
"value": "dots"
},
{
"label": "dots-bar",
"value": "dots-bar"
}
]
}
]
4 changes: 2 additions & 2 deletions src/collapse/collapse-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useCollapseAnimation from './useCollapseAnimation';
export default defineComponent({
name: 'TCollapsePanel',
props,
setup(props: TdCollapsePanelProps, context) {
setup(props: TdCollapsePanelProps) {
const renderTNodeJSX = useTNodeJSX();
const componentName = usePrefixClass('collapse-panel');
const disableClass = usePrefixClass('is-disabled');
Expand All @@ -25,7 +25,7 @@ export default defineComponent({
expandIconPlacement,
expandOnRowClick,
expandIcon: expandIconAll,
} = inject('collapseProps');
} = inject<any>('collapseProps');
const innerValue = value.value || getUniqId();
const showExpandIcon = computed(() => (expandIcon.value === undefined ? expandIconAll.value : expandIcon.value));
if (defaultExpandAll.value) {
Expand Down
2 changes: 2 additions & 0 deletions src/swiper/swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ export default defineComponent({
`${prefix.value}-swiper__navigation`,
{
[`${prefix.value}-swiper__navigation-bars`]: navigationConfig.value.type === 'bars',
[`${prefix.value}-swiper__navigation-dots`]: navigationConfig.value.type === 'dots',
[`${prefix.value}-swiper__navigation-dots-bar`]: navigationConfig.value.type === 'dots-bar',
},
]}
>
Expand Down
4 changes: 2 additions & 2 deletions src/textarea/textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineComponent, computed, watch, ref, nextTick, onMounted, toRefs, inject, StyleValue } from 'vue';
import props from './props';
import { TextareaValue } from './type';
import { TextareaValue, TdTextareaProps } from './type';
import { getCharacterLength, omit } from '../utils/helper';
import calcTextareaHeight from './calcTextareaHeight';
import { FormItemInjectionKey } from '../form/const';
Expand All @@ -26,7 +26,7 @@ export default defineComponent({
inheritAttrs: false,
props: { ...props },

setup(props, { attrs, expose }) {
setup(props: TdTextareaProps, { attrs, expose }) {
const prefix = usePrefixClass();
const name = usePrefixClass('textarea');
const TEXTAREA_TIPS_CLASS = computed(() => `${name.value}__tips`);
Expand Down
4 changes: 4 additions & 0 deletions src/textarea/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export interface TdTextareaProps {
* 文本框值
*/
value?: TextareaValue;
/**
* 输入框的值
*/
modelValue?: TextareaValue;
/**
* 文本框值,非受控属性
*/
Expand Down
2 changes: 1 addition & 1 deletion test/unit/swiper/__snapshots__/index.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ exports[`Swiper > :props > :navigation 1`] = `
</div>
</div>
<ul
class="t-swiper__navigation"
class="t-swiper__navigation t-swiper__navigation-dots-bar"
>

<li
Expand Down