//获取应用实例 const app = getApp() const utils = require('../../utils/util.js') Component({ properties: { title: { type: String, value: '这是弹框标题' }, type: { type: String, value: 'text' }, maxlength: { type: Number, value: 140 } }, data: { fadeIn: false, value: '' }, methods: { confirm(e) { let value = utils.trimAll(this.data.value) if (value === '') { utils.toast('内容不能为空') return } this.triggerEvent('confirm', value) }, getContent(e) { this.setData({ value: e.detail.value }) }, showModal() { this.setData({ fadeIn: true }) }, hideModal() { this.setData({ fadeIn: false }) } } })