This repository has been archived by the owner on Dec 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
137 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<template> | ||
<page header-title="Textarea 多行文本框"> | ||
<panel title="基础用法"> | ||
<example-item> | ||
<at-textarea | ||
placeholder="通过 onChange 更新 value 的值..." | ||
:max-length="200" | ||
:value="value1" | ||
@change="handleChange('value1', $event)" | ||
/> | ||
</example-item> | ||
</panel> | ||
|
||
<panel title="不显示字数"> | ||
<example-item> | ||
<at-textarea | ||
placeholder="通过 v-model:value 更新 value 的值..." | ||
:count="false" | ||
:max-length="200" | ||
v-model:value="value2" | ||
/> | ||
</example-item> | ||
</panel> | ||
|
||
<panel title="文字超出仍可输入"> | ||
<example-item> | ||
<at-textarea | ||
placeholder="通过 v-model:value 更新 value 的值..." | ||
:text-overflow-forbidden="false" | ||
:max-length="200" | ||
v-model:value="value3" | ||
/> | ||
</example-item> | ||
</panel> | ||
|
||
<panel title="自定义高度"> | ||
<example-item> | ||
<at-textarea | ||
placeholder="通过 v-model:value 更新 value 的值..." | ||
height="300" | ||
:max-length="200" | ||
v-model:value="value4" | ||
/> | ||
</example-item> | ||
</panel> | ||
</page> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, reactive, toRefs } from 'vue' | ||
import { AtTextarea } from '../../../index' | ||
import { Page, Panel, ExampleItem } from '../../components/demo-page' | ||
import './index.scss' | ||
interface IndexState { | ||
[key: string]: string | ||
} | ||
export default defineComponent({ | ||
name: "TextareaDemo", | ||
components: { | ||
AtTextarea, | ||
Page, | ||
Panel, | ||
ExampleItem | ||
}, | ||
setup() { | ||
const state = reactive<IndexState>({ | ||
value1: '', | ||
value2: '', | ||
value3: '', | ||
value4: '' | ||
}) | ||
function handleChange(stateName: string, value: string): void { | ||
state[stateName] = value | ||
} | ||
return { | ||
...toRefs(state), | ||
handleChange | ||
} | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters