antd-mini
Advanced tools
Comparing version 0.0.3 to 0.0.4-beta.1
import { TipsDefaultProps } from './props'; | ||
import { log } from '../_util/console'; | ||
Component({ | ||
props: TipsDefaultProps, | ||
data: { | ||
_show: true | ||
_show: false | ||
}, | ||
didMount: function didMount() { | ||
this.showError(); | ||
this.setData({ | ||
_show: this.props.visible | ||
}); | ||
}, | ||
didUpdate: function didUpdate() { | ||
this.showError(); | ||
didUpdate: function didUpdate(prevProps) { | ||
if (prevProps.visible !== this.props.visible) { | ||
this.setData({ | ||
_show: this.props.visible | ||
}); | ||
if (this.props.visible === false) { | ||
this.beforeClose(); | ||
} | ||
} | ||
}, | ||
methods: { | ||
showError: function showError() { | ||
var title = this.props.title; | ||
if (!title) { | ||
log.warn('Tips', '缺少 title 属性。'); | ||
} | ||
}, | ||
onButtonTap: function onButtonTap() { | ||
@@ -33,4 +35,10 @@ var onButtonTap = this.props.onButtonTap; | ||
}); | ||
this.beforeClose(); | ||
}, | ||
beforeClose: function beforeClose() { | ||
if (typeof this.props.onClose === "function") { | ||
this.props.onClose(); | ||
} | ||
} | ||
} | ||
}); |
@@ -29,2 +29,7 @@ import { IBaseProps } from '../_base'; | ||
/** | ||
* @description 是否显示 Tips 组件 | ||
* @default true | ||
*/ | ||
visible?: boolean; | ||
/** | ||
* @description 关闭按钮位置 | ||
@@ -31,0 +36,0 @@ * @default right |
export const TipsDefaultProps = { | ||
showClose: false, | ||
buttonPosition: 'bottom', | ||
visible:true, | ||
onClose: () => {} | ||
}; |
{ | ||
"name": "antd-mini", | ||
"version": "0.0.3", | ||
"version": "0.0.4-beta.1", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "dev": "minidev dev --less --typescript --no-source-map", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
321431
6047