Merge branch 'master' of github.com:07akioni/naive-ui

This commit is contained in:
07akioni 2020-01-13 23:07:30 +08:00
commit d5b259810e
8 changed files with 165 additions and 3 deletions

View File

@ -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;
}
```

View 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: ''
}
}
}
```

View File

@ -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: ''
}
}
}
```

View File

@ -0,0 +1,6 @@
# 自动完成
```demo
basic
custom-input
after-select
```

View File

@ -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
```
```

View 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;
}
```

View 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>
```

View File

@ -0,0 +1,7 @@
# 元素
元素和配置消费者类似但当主题改变时会应用不同的class。
## 演示
```demo
basic
color
```