<script cml-type="interface">
/*
定义一个inteface用于描述组件的属性和事件
1、 如果区分组件属性和事件？
通过类型来区分，事件为函数类型，属性为非函数类型
2、 如何定义组件属性
给interface添加同名的属性即可，指定类型
3、 如何定义组件事件
以事件名称为key值给interface定义属性，该属性是一个函数类型，返回值为void，
定义函数的第一个参数为自定义事件传递的detail对象类型
*/

//定义事件detail对象的参数
type EventDetail = {
  type: String,
  disabled: Boolean
}

type getuserinfoEventDetail = {
  errMsg: String,
  rawData: String,
  signature: String,
  encryptedData: String,
  iv: String,
  userInfo: userInfo
}
type userInfo = {
  nickName: String,
  avatarUrl: String,
  gender: Number,
  country: String,
  province: String,
  city: String,
  language: String
}
type getphonenumberEventDetail = {
  errMsg: String,
  encryptedData: String,
  iv: String
}
type errorEventDetail = {
  errMsg: String
}
interface ButtonInterface {
  text: String,
  size: String,
  type: String,
  disabled: Boolean,
  btnStyle: String,
  textStyle: String,
  disabledStyle: String,
  openType: String,
  lang: String,
  sessionFrom: String,
  sendMessageTitle: String,
  sendMessagePath: String,
  sendMessageImg: String,
  showMessageCard: Boolean,
  appParameter: String,
  onclick(eventDetail: EventDetail): void;
  getuserinfo(eventDetail: getuserinfoEventDetail): void;
  contact(eventDetail: void): void;
  getphonenumber(eventDetail: getphonenumberEventDetail): void;
  error(eventDetail: errorEventDetail): void; 
  opensetting(eventDetail: void): void; 
}
</script>
