const Magix = require('magix') const View = require('dmp-new/view') module.exports = View.extend({ tmpl: '@content.html', init () { this.observeLocation(['id']) }, async render () { const content = await this.getContent() this.updater.digest({ content }) }, async getContent () { const loc = Magix.Router.parse() try { const models = [{ name: 'api_commoncontent_getContent_get', dataType: 'jsonp', params: { id: loc.get('id') } }] const [model] = await this.fetch(models) const content = model.get('data.content', {}) return content } catch (error) { this.alert('错误提示', error.msg || error.message) } } })