123456789101112131415161718192021222324252627282930 |
- Component({
- props: {
- checked: {
- type: Boolean,
- default: false
- },
- onChange: {
- type: Function,
- default: () => {}
- }
- },
- data: {
- mChecked: false
- },
- methods: {
- change() {
- this.setData({
- mChecked: !this.data.mChecked
- })
- this.props.onChange(this.data.mChecked)
- }
- },
- rootEvents: {
- onReady() {
- this.setData({
- mChecked: this.props.checked
- })
- }
- }
- })
|