mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-30 12:52:43 +08:00
Merge branch 'master' of github.com:07akioni/naive-ui
This commit is contained in:
commit
d5b259810e
@ -0,0 +1,45 @@
|
||||
# 选择后的动作
|
||||
```html
|
||||
<n-auto-complete
|
||||
:options="options"
|
||||
v-model="value"
|
||||
clear-after-select
|
||||
placeholder="选择后清空"
|
||||
/>
|
||||
<n-auto-complete
|
||||
:options="options"
|
||||
v-model="value"
|
||||
blur-after-select
|
||||
placeholder="选择后失焦"
|
||||
/>
|
||||
```
|
||||
```js
|
||||
export default {
|
||||
computed: {
|
||||
options () {
|
||||
return [
|
||||
'@gmail.com',
|
||||
'@163.com',
|
||||
'@qq.com'
|
||||
].map(suffix => {
|
||||
const value = this.value === null ? '' : this.value
|
||||
const prefix = value.split('@')[0]
|
||||
return {
|
||||
label: prefix + suffix,
|
||||
value: prefix + suffix,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
value: null
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```css
|
||||
.n-auto-complete {
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
```
|
28
demo/documentation/components/autoComplete/zhCN/basic.md
Normal file
28
demo/documentation/components/autoComplete/zhCN/basic.md
Normal file
@ -0,0 +1,28 @@
|
||||
# 基础
|
||||
```html
|
||||
<n-auto-complete :options="options" v-model="value" placeholder="邮箱" />
|
||||
```
|
||||
```js
|
||||
export default {
|
||||
computed: {
|
||||
options () {
|
||||
return [
|
||||
'@gmail.com',
|
||||
'@163.com',
|
||||
'@qq.com'
|
||||
].map(suffix => {
|
||||
const prefix = this.value.split('@')[0]
|
||||
return {
|
||||
label: prefix + suffix,
|
||||
value: prefix + suffix,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
value: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
@ -0,0 +1,39 @@
|
||||
# 自定义输入元素
|
||||
```html
|
||||
<n-auto-complete :options="options" v-model="value">
|
||||
<template v-slot:activator="{ handleInput, handleBlur, handleFocus, value }">
|
||||
<n-input
|
||||
type="textarea"
|
||||
@input="handleInput"
|
||||
@focus="handleFocus"
|
||||
@blur="handleBlur"
|
||||
:value="value"
|
||||
placeholder="邮箱"
|
||||
/>
|
||||
</template>
|
||||
</n-auto-complete>
|
||||
```
|
||||
```js
|
||||
export default {
|
||||
computed: {
|
||||
options () {
|
||||
return [
|
||||
'@gmail.com',
|
||||
'@163.com',
|
||||
'@qq.com'
|
||||
].map(suffix => {
|
||||
const prefix = this.value.split('@')[0]
|
||||
return {
|
||||
label: prefix + suffix,
|
||||
value: prefix + suffix,
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
value: ''
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
@ -0,0 +1,6 @@
|
||||
# 自动完成
|
||||
```demo
|
||||
basic
|
||||
custom-input
|
||||
after-select
|
||||
```
|
@ -1,7 +1,7 @@
|
||||
# Element
|
||||
Element is similar to config consumer but has different class apply to it when theme changes.
|
||||
# Demos
|
||||
Element is similar to Config Consumer but has different class apply to it when theme changes.
|
||||
## Demos
|
||||
```demo
|
||||
basic
|
||||
color
|
||||
```
|
||||
```
|
||||
|
23
demo/documentation/components/element/zhCN/basic.md
Normal file
23
demo/documentation/components/element/zhCN/basic.md
Normal file
@ -0,0 +1,23 @@
|
||||
# 基础
|
||||
当配置提供者提供深色主题时,它应用 `n-dark-theme` class。当配置提供者提供浅色主题时,它应用 `n-light-theme` class。若非二者之一,它不会应用额外的class,正如其他特定主题的Naive UI组件。
|
||||
|
||||
创建特定主题的组件十分管用。
|
||||
|
||||
```html
|
||||
<n-element as="span" class="myel">
|
||||
我的元素
|
||||
</n-element>
|
||||
```
|
||||
```css
|
||||
.myel {
|
||||
transition: color .3s cubic-bezier(.4, 0, .2, 1);
|
||||
}
|
||||
|
||||
.myel.n-light-theme {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.myel.n-dark-theme {
|
||||
color: yellow;
|
||||
}
|
||||
```
|
14
demo/documentation/components/element/zhCN/color.md
Normal file
14
demo/documentation/components/element/zhCN/color.md
Normal file
@ -0,0 +1,14 @@
|
||||
# 样式方案
|
||||
|
||||
```html
|
||||
<n-element as="div" class="myel">
|
||||
<template v-slot="{ styleScheme }">
|
||||
<pre
|
||||
:style="{
|
||||
color: styleScheme.textSecondaryColor,
|
||||
transition: `color .3s ${styleScheme.cubicBezierEaseInOut}`
|
||||
}"
|
||||
>{{ JSON.stringify(styleScheme, 0, 2) }}</pre>
|
||||
</template>
|
||||
</n-element>
|
||||
```
|
@ -0,0 +1,7 @@
|
||||
# 元素
|
||||
元素和配置消费者类似,但当主题改变时会应用不同的class。
|
||||
## 演示
|
||||
```demo
|
||||
basic
|
||||
color
|
||||
```
|
Loading…
Reference in New Issue
Block a user