@mini-dev/directive-views
Version:
73 lines (46 loc) • 1.36 kB
Markdown
# @mini-dev/directive-views
用组件方式来调用小程序的 API。
## 安装
```bash
npm install @mini-dev/directive-views --save
```
## 使用
首先需要在对应的页面引入对应的组件:
```json
{
"usingComponents": {
"copy": "@mini-dev/directive-views/copy/index",
"debug": "@mini-dev/directive-views/debug/index",
"function": "@mini-dev/directive-views/function/index",
"route": "@mini-dev/directive-views/route/index"
}
}
```
### 复制(copy)
```html
<copy value="你好">
<button type="default">复制 value 的值</button>
</copy>
```
### 调试开关(debug)
```html
<debug open="开启调试" close="关闭调试"/>
```
### 函数调用(function)
```html
<function directive-class='function' name='function1' arg="{name:'fn1'}" auto />
<function directive-class='function' name='function1' arg="[1,'a', {name:''fn1}]" auto />
```
### 路由(route)
```html
<route directive-class="route" url="/pages/page2/index" auto/>
```
更多配置方式:具体可以参见示例 [pages](./pages)
## Changelogs
### 0.0.3
1. 增加function的数组参数;
2. 统一 ext-class 的使用方式;
### 0.0.2
1. 修正针对小程序的 package.json 配置;
### 0.0.1
1. 添加常用的操作;