Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
v_jdongchen committed Dec 15, 2020
1 parent c31baa7 commit dbcb2e0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
63 changes: 49 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,58 @@
-->
# jd-moremsg

## 安装依赖
```
npm install
```
一个基于vue的“更多信息”的单个组件

### 开发
```
npm run dev
```
## props

|props|描述|备注|
|---|---|---|
|[text](#text)|设置文本|none|
|[setup](#setup)|设置基本属性|none|
|[follow](#follow)|设置跟随性质|none|

#### text

该prop用来设置要显示的更多信息

> @Prop({default: ''}) private text?:string;
### 打包
```
npm run build
```

### 单元测试
#### setup

该prop用来设置一些基本属性

> @Prop() private setup?:Setup;
```ts
interface Setup {
duration?:number; // 隔多久显示
width?:string; // 宽度, 与css属性一致
height?:string; // 高度, 与css属性一致
background?:string; // 背景, 与css属性一致
}
```
npm run test:unit

默认值:

```ts
private defaultSetup:Setup = {
duration: 2000,
width: 'auto',
height: 'auto',
background: '#fff'
}
```

#### follow

该prop用来设置此组件的跟随性质,默认为空字符串

> @Prop({default: ''}) private follow?:string;
|可选值|状态|备注|
|---|---|---|
|'follow'|鼠标在组件内部移动时moremsg会跟随移动,当mouseleave时消失|none|
|'none'|鼠标在组件内移动时mroemsg会马上消失|none|
|''|鼠标在组件内部移动时moremsg不会消失,当mouseleave时消失|default|

3 changes: 1 addition & 2 deletions lib/MoreMsg/MoreMsg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ export default class MoreMsg extends Vue {
}

@Prop({default: ''}) private text?:string;
@Prop({default: false}) private show?:boolean;
@Prop()
private setup?:Setup;
@Prop() private follow?:string;
@Prop({default: ''}) private follow?:string;

public get computedSetup():Setup {
return Object.assign(this.defaultSetup, this.setup)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"private": false,
"author": "isJDongYa",
"description": "",
"description": "一个基于vue的“更多信息”的单个组件",
"files": ["dist/**/*"],
"keywords": [
"vue",
Expand Down

0 comments on commit dbcb2e0

Please sign in to comment.