{"size": 1750, "ext": "js", "max_stars_repo_path": "lib/foot-post-line/index.js", "max_stars_repo_name": "RussellCao824/russell-weapp", "max_stars_repo_stars_event_min_datetime": "2020-07-16T17:09:27.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-16T17:09:27.000Z", "max_issues_repo_path": "lib/foot-post-line/index.js", "max_issues_repo_name": "RussellCao824/russell-weapp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/foot-post-line/index.js", "max_forks_repo_name": "RussellCao824/russell-weapp", "max_forks_repo_forks_event_min_datetime": "2020-07-31T02:41:21.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-31T02:41:21.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 17.6767676768, "max_line_length": 75, "alphanum_fraction": 0.4982857143}
import { getNowDate } from '../js/Utils'
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    //如果父页面传入的属性值和属性定义数据类型不一致，组件会自动对其进行转换
    iconName: {
      type: String,
      value: 'iconRectangleCopy2'
    },
    value: {
      type: String,
      value: getNowDate()
    },
    valueContent: {
      type: String,
      value: getNowDate()
    },
    postTitle: {
      type: String,
      value: '发布'
    },
    title: {
      type: String,
      value: '拍摄于'
    },
    start: {
      type: String,
      value: '2020-01-01'
    },
    end: {
      type: String,
      value: getNowDate()
    },
    mode: {
      type: String,
      value: 'date'
    },
    range: {
      type: Array,
      value: []
    },
    rangeKey: {
      type: String,
      value: 'name'
    },
    pickerShow: {
      type: Boolean,
      value: true
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
  },

  /**
   * 自定义组件生命周期函数对象集合
   */
  lifetimes: {
    /**
     * attached阶段，自定义组件的内部数据就可以进行赋值，相当于page的onload生命阶段
     */
    attached: function () {
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    /**
     * picker选择响应函数(目前兼容date,time,selector单列选择器)
     * @param {*} event 
     */
    bindDateChange(event) {
      const value = event.detail.value;
      if (this.data.mode == 'date' || this.data.mode == 'time') {
        this.setData({ value, valueContent: value });
      } else if (this.data.mode == 'selector') {
        this.setData({ value, valueContent: this.data.range[value].name });
        //向父页面传递单列选择器选择的子项的索引
        this.triggerEvent('datechange', { value });
      }
    },

    /**
     * 点击发布按钮
     * @param {*} event 
     */
    postSubmit(event) {
      this.triggerEvent('postsubmit', { photoDate: this.data.date });
    }
  }

})