exhibition-register.js 884 B

1234567891011121314151617181920212223242526272829303132
  1. import { VueLikePage } from '../../utils/page'
  2. import displayApi from '../../apis/exhibition'
  3. VueLikePage([], {
  4. data: {
  5. },
  6. methods: {
  7. onLoad () {
  8. displayApi.getExhibitionDetail().then(res => {
  9. this.setData({
  10. html: this.formatImg(res.data.contactUs)
  11. })
  12. })
  13. },
  14. formatImg: function (html) {
  15. var newContent = html.replace(/<img[^>]*>/gi, function (match, capture) {
  16. let processed=null;
  17. //如果原img标签不存在style属性值
  18. if(!match.match(/style=\"(.*)\"/gi)){
  19. processed=match.replace(/\<img/g, '<img style="width:100%;height:auto;display:block"');
  20. }else{
  21. processed = match.replace(/style=\"(.*)\"/gi, 'style="width:100%;height:auto;display:block"');
  22. }
  23. return processed;
  24. })
  25. return newContent;
  26. },
  27. collect (e) {
  28. }
  29. }
  30. })