const config = require('../../config/config') const util = require('../../utils/util') const download = require('../../utils/download') Component({ properties: { // 是否同意协议 read: { type: Boolean, value: false }, // 是否显示气泡 show: { type: Boolean, value: false } }, data: {}, lifetimes: { // 在组件实例进入页面节点树时执行 attached: function() {}, // 在组件实例被从页面节点树移除时执行 detached: function() {} }, methods: { toggleRead({ detail }) { if (detail) this.triggerEvent('hidePopover') this.triggerEvent('toggleRead', detail) }, showAgreement({ currentTarget }) { const { type } = currentTarget.dataset const url = type == 'user' ? config.userAgreement : config.privacyPolicy util.showLoad('加载中') download.openAgreement(url).then(() => util.hideLoad()).catch(() => util.hideLoad()) } } })