Avalon Learning Notes UI Chapter-datepicker Chapter

Source: Internet
Author: User

First, Introduction

First Avalon is my first contact with the MVVM framework, ANGULARJS can also achieve the basic same function, but the products of foreigners are more advanced, they have already given up in IE, as the big celestial us, or must RTHK RTHK industry to serve the IE6, That's why I chose Avalon and didn't angularjs. Official documents are old wording, which makes me can not help but deep spit groove is beautiful, well, maintenance of a framework is difficult, is the United States refueling bar.

Second, calendar plugin Chapter DatePicker

Parameters for official documents:

  
 
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset=‘utf-8‘/>
  5. <title>datepicker demo</title>
  6. <script src=‘avalon.js‘></script>
  7. </head>
  8. <body>
  9. <div class="demo-show" ms-controller="demo">
  10. <fieldset style="position: relative; z-index: 2">
  11. <legend>默认配置的单日历框</legend>
  12. <input ms-widget="datepicker"/>
  13. <p>说明:默认情况下,日历显示方式从周一到周日,显示一个月份,输输入域不允许为空,点击next、pre切换月份时,默认切换一个月,并且不可通过下拉框切换月份和年份</p>
  14. </fieldset>
  15. <fieldset style="position: relative; z-index: 1">
  16. <legend>默认配置的单日历框</legend>
  17. <input ms-widget="datepicker" data-datepicker-allow-blank="true"/>
  18. <p>说明:此demo配置allowBlank为true,使得输入域可以为空,与第一个demo做对比</p>
  19. </fieldset>
  20. <script>
  21. require(["datepicker/avalon.datepicker"], function(avalon) {
  22. var model = avalon.define("demo", function(vm) {
  23. })
  24. avalon.scan();
  25. })
  26. </script>
  27. </div>
  28. </body>
  29. </html>

1, first Avalonu use of REQUIREJS this modular management tool

 
   
  
  1. require(["引用的模块"],function(){
  2. //具体代码
  3. })
2.The Calendar plugin relies on the AVALONJS and avalon.datepicker.js two modules, the official document, which will be avalonjs as a globally dependent module
 
   
  
  1. <script src=‘avalon.js‘></script>
dependency of the Avalon.datepicker.js module
 
   
  
  1. require(["datepicker/avalon.datepicker"],function(){
  2. //在这里引用了avalon.datepicker模块
  3. })
        If Avalon is not set to a globally dependent module, then the notation is
 
   
  
  1. require(["avalon","avalon.datepicker"],function(){
  2. //依赖了avalon.js和avalon.datepicker
  3. })
3, in the introduction of HTML can
 
   
  
  1. <input ms-widget="datepicker"/>
Insert this line of code where you need it, and the calendar plugin will take effect.
Iii. new wording after the Avalon update, the wording changed, but the official UI was not updated.
1. HTML notation
  
 
  1. Basics.html
  2. <!DOCTYPE html>
  3. <html>
  4. <head lang="en">
  5. <meta charset="UTF-8">
  6. <title></title>
  7. </head>
  8. <body>
  9. <div ms-controller="datebat">
  10. <input ms-widget="datepicker"/>
  11. </div>
  12. </body>
  13. <script src="bower_components/requirejs/require.js" data-main="Basicsmain.js" defer async="true"></script>
  14. </html>
2. JS notation
 
   
  
  1. Basics.js
  2. require([‘avalon‘,‘avalon-date‘],function(avalon){
  3. avalon.ready(function(){
  4. var datemodule = avalon.define({
  5. $id: ‘datebat‘
  6. });
  7. avalon.scan()
  8. })
  9. })
3. Require configuration
 
   
  
  1. //Basicsmain.js
  2. require.config({
  3. paths : {
  4. ‘avalon‘ : ‘bower_components/avalon/min/avalon.min‘,
  5. ‘avalon-date‘ : ‘bower_components/avalononiui/datepicker/avalon.datepicker‘
  6. }
  7. });
  8. require([
  9. ‘app/Basics.js‘
  10. ]);//require我不是很熟悉,希望大神不要吐槽,哈哈哈哈
Four, the use of Avalonui, the required preparation work 1, quoting Avalonjs.
2, reference the corresponding UI, the Avalonui JS
3, using Requirejs dependent module.
4, do not use the old wording, perhaps the day is not happy, the old wording deleted, then the tragedy. 5, download Good Avalonui, this UI is a bit large.    I haven't found the optimization method yet. 6. Download Avalon.
7, download Requirejs.
Gitcafe Code Address: Https://gitcafe.com/Zjingwen/demo.gitspecific location inDEMO/2015/4/28/thecalendaravalon, I slightly modified the following CSS effect a little different.
<---2015/4/28 to be continued--->




From for notes (Wiz)

Avalon Learning Notes UI Chapter-datepicker Chapter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.