UNPKG

captain-ui

Version:

有赞vue wap业务组件库

102 lines (97 loc) 2.95 kB
export default { render: function render() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _c('div', { staticClass: "cap-title", class: { 'cap-title--normal': +_vm.type === 0, 'cap-title--wx': +_vm.type === 1 }, style: _vm.titleStyle }, [_c('h2', { staticClass: "cap-title__main" }, [_vm._v("\n " + _vm._s(_vm.title) + "\n "), +_vm.type === 0 && _vm.link.title ? _c('span', { staticClass: "cap-title__custom-link" }, [_vm._v("\n -\n "), _c('a', { staticClass: "cap-title__link", attrs: { "href": _vm.link.link_url } }, [_vm._v("\n " + _vm._s(_vm.link.title) + "\n ")])]) : _vm._e()]), _vm.subTitleVisble ? _c('p', { staticClass: "cap-title__sub" }, [+_vm.type === 0 && _vm.subTitle ? _c('span', { staticClass: "cap-title__sub-title" }, [_vm._v("\n " + _vm._s(_vm.subTitle) + "\n ")]) : _vm._e(), +_vm.type === 1 ? [_vm.wxDate ? _c('span', { staticClass: "cap-title__date" }, [_vm._v("\n " + _vm._s(_vm.wxDate) + "\n ")]) : _vm._e(), _vm.wxAuthor ? _c('span', { staticClass: "cap-title__author" }, [_vm._v("\n " + _vm._s(_vm.wxAuthor) + "\n ")]) : _vm._e(), _vm.wxLinkTitle ? _c('a', { class: _vm.wxLinkClass, attrs: { "href": +_vm.wxLinkType === 0 ? 'javascript:;' : _vm.wxLink.link_url } }, [_vm._v("\n " + _vm._s(_vm.wxLinkTitle) + "\n ")]) : _vm._e()] : _vm._e()], 2) : _vm._e()]); }, name: 'cap-title', props: { type: { type: [String, Number], default: 0 }, title: { type: String, required: true }, subTitle: String, backgroundColor: String, showMethod: [String, Number], link: { type: Object, default: function _default() { return {}; } }, wxDate: String, wxAuthor: String, wxLinkTitle: String, wxLinkUrl: String, wxLinkType: { type: [String, Number], default: 0 }, wxLink: { type: Object, default: function _default() { return {}; } } }, computed: { titleStyle: function titleStyle() { var showMethod = +this.showMethod; var align; if (showMethod === 0) { align = 'left'; } else if (showMethod === 1) { align = 'center'; } else if (showMethod === 2) { align = 'right'; } return { backgroundColor: this.backgroundColor, textAlign: align }; }, subTitleVisble: function subTitleVisble() { var type = +this.type; return type === 0 && this.subTitle || type === 1 && (this.wxDate || this.wxAuthor || this.wxLinkTitle); }, wxLinkClass: function wxLinkClass() { return ['cap-title__link', { 'js-open-follow': +this.wxLinkType === 0 }]; } } };