From 59bfbe2e56c582fb4c8cc6e1f3219f327206c955 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E7=99=BB=E8=8D=A3?= Date: Wed, 13 Mar 2019 15:17:15 +0800 Subject: [PATCH 1/2] update readme --- README.md | 37 ++++++++++++++++++++++++++----------- docs/README.md | 7 +++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 92337dd..1b6ed43 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ### 思路分析 -要实现一个简单的日历,需要先知道几个值: +要实现一个简单的小程序日历,需要先知道几个值: - 每月有多少天 @@ -14,23 +14,38 @@ > 每月最多31天,最少28天。 -### 引入 wxml 及 wxss后初始化日历组件直接使用 + +#### 1. 引入组件 + +在页面 `json` 文件中配置组件 + +```json +{ + "usingComponents": { + "calendar": "../../component/calendar/index" + } +} +``` + +在页面 `wxml` 中引入组件 +```xml + +``` + +#### 2. 初始化 + ```js -import initCalendar from '../../template/calendar/index'; +import initCalendar from '../../component/calendar/main.js'; const conf = { - onShow() { - initCalendar(); // 使用默认配置初始化日历 + onShow: function() { + initCalendar(); // 自定义配置 initCalendar({ multi: true, ... }) } }; Page(conf); ``` -更多配置及功能请 [参考文档](http://calendar.isfeer.com) +更多自定义配置及功能 [请查阅日历文档](http://calendar.isfeer.com) -### 日历模板效果图 +### 效果图 ![日历效果图](https://raw.githubusercontent.com/treadpit/wx_calendar/develop/screenshot/screenshot_calendar.gif) - -### 日期选择器效果图 - -![日期选择器](https://raw.githubusercontent.com/treadpit/wx_calendar/develop/screenshot/screenshot_datepicker.gif) diff --git a/docs/README.md b/docs/README.md index b74b593..b5793b0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -12,6 +12,8 @@ #### 1. 引入组件 +在页面 `json` 文件中配置组件 + ```json { "usingComponents": { @@ -20,6 +22,11 @@ } ``` +在页面 `wxml` 中引入组件 +```xml + +``` + #### 2. 日历组件初始化 ```js From 84d5f3904c6a12ae7a07b27a05ab112a3b26942a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E7=99=BB=E8=8D=A3?= Date: Wed, 13 Mar 2019 15:22:02 +0800 Subject: [PATCH 2/2] update readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b6ed43..d0b3078 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ > 每月最多31天,最少28天。 -#### 1. 引入组件 +### 引入组件 在页面 `json` 文件中配置组件 @@ -32,7 +32,7 @@ ``` -#### 2. 初始化 +### 初始化 ```js import initCalendar from '../../component/calendar/main.js';