From fe87464eba25666fc66b50352413073833ed1f7b Mon Sep 17 00:00:00 2001
From: Lindy <33708359+Lindysen@users.noreply.github.com>
Date: Wed, 4 Dec 2019 18:06:48 +0800
Subject: [PATCH] docs(Search): fix demo problem (#2458)
* docs(Search): fix demo problem
* docs(Search): add demo script
* docs(Search): adjust docs
---
example/pages/search/index.js | 11 ++++++++++-
example/pages/search/index.wxml | 2 +-
packages/search/README.md | 25 ++++++++++++++++++++++++-
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/example/pages/search/index.js b/example/pages/search/index.js
index 8d4fec15..bb7cf7a4 100644
--- a/example/pages/search/index.js
+++ b/example/pages/search/index.js
@@ -11,7 +11,16 @@ Page({
});
},
- onSearch(event) {
+ onSearch() {
+ if (this.data.value) {
+ wx.showToast({
+ title: '搜索:' + this.data.value,
+ icon: 'none'
+ });
+ }
+ },
+
+ onClick() {
if (this.data.value) {
wx.showToast({
title: '搜索:' + this.data.value,
diff --git a/example/pages/search/index.wxml b/example/pages/search/index.wxml
index 68c2bd96..089707fa 100644
--- a/example/pages/search/index.wxml
+++ b/example/pages/search/index.wxml
@@ -29,6 +29,6 @@
label="地址"
shape="round"
>
- 搜索
+ 搜索
diff --git a/packages/search/README.md b/packages/search/README.md
index e03638d1..c4ede2f8 100644
--- a/packages/search/README.md
+++ b/packages/search/README.md
@@ -43,12 +43,35 @@
value="{{ value }}"
placeholder="请输入搜索关键词"
use-action-slot
+ bind:change="onChange"
bind:search="onSearch"
>
- 搜索
+ 搜索
```
+```javascript
+Page({
+ data: {
+ value: ''
+ },
+
+ onChange(e) {
+ this.setData({
+ value: e.detail
+ });
+ },
+
+ onSearch() {
+ Toast('搜索' + this.data.value);
+ },
+
+ onClick() {
+ Toast('搜索' + this.data.value);
+ },
+});
+```
+
## API
### Props