Component({ /** * 组件样式隔离 */ options: { addGlobalClass: true, multipleSlots: true // 支持多个slot }, properties: { value: { type: String, value: null }, placeholder: { type: String, value: '' } }, /** * 组件的初始数据 */ data: { editing: false }, /** * 组件的方法列表 */ methods: { onEdit: function(e) { this.setData({ editing: true }) }, onBlur: function(e) { this.setData({ editing: false }) }, bindInput: function(e) { this.setData({ value: e.detail.value }) this.triggerEvent('change', this.data.value) } } })