antd-mini-rpx
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-rpx", | ||
"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
321439
6047