123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- const app = getApp()
- import {
- throttle,
- getWaterDrop
- } from '../../utils/index/index'
- Component({
-
- properties: {
- isVisible: {
- type: Boolean,
- value: false,
- observer: "handleVisibilityChange"
- }
- },
- props: {
-
- visible: {
- type: Boolean,
- value: false
- },
-
- content: {
- type: String,
- value: ''
- },
-
-
- showCancelBtn: {
- type: Boolean,
- value: true,
- observer(newVal, oldVal) {
-
- console.log('myProperty changed from', oldVal, 'to', newVal);
- this.updateValue(newVal);
- }
- },
-
- showOkBtn: true,
-
- cancelText: '取消',
-
- okText: '确认',
-
- onCancel: {
- type: Function,
- value: () => {}
- },
-
- onOk: {
- type: Function,
- value: () => {}
- },
- },
-
- data: {
- btnStatus: true,
- },
- lifetimes: {
- attached() {
-
- this.handleVisibilityChange(this.data.isVisible);
- }
- },
- didMount() {
- console.log(this.props.showCancelBtn)
- },
- didUpdate(newVal, oldVal) {
- console.log('didUpdate', newVal, oldVal)
- console.log(this.props.showCancelBtn)
- },
-
- methods: {
- handleVisibilityChange(isVisible) {
- console.log("Visibility on load:", isVisible);
- },
- updateValue(newVal) {
- console.log(newVal)
-
- this.setData({
- btnStatus: newVal
- });
- },
- cancel: throttle( function () {
- setTimeout(()=>{
- this.props.onCancel();
- }, 100)
- }, 1000),
- confirm: throttle( function () {
- setTimeout(()=>{
- this.props.onOk();
- }, 100)
- }, 1000),
- },
- observers: {}
- })
|