graceAnalysis.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view class="grace-editor-show">
  3. <view v-for="(item, index) in article" :key="index" class="grace-editor-show-item">
  4. <text class="grace-editor-show-txt" v-if="item.type == 'txt'">{{item.content}}</text>
  5. <view class="grace-flex-center" v-else-if="item.type == 'center'">
  6. <text class="grace-editor-show-center">{{item.content}}</text>
  7. </view>
  8. <image class="grace-editor-show-image" :src="item.content"
  9. v-else-if="item.type == 'img'" :data-url="item.content" @tap="showImgs" mode="widthFix"></image>
  10. <text class="grace-editor-show-quote" v-else-if="item.type == 'quote' || item.type == 'pre'">{{item.content}}</text>
  11. <text class="grace-editor-show-strong" v-else-if="item.type == 'strong'">{{item.content}}</text>
  12. <view v-else-if="item.type == 'link'" class="grace-editor-show-link">
  13. <graceLink :url="item.content" :title="item.content"></graceLink>
  14. </view>
  15. <text class="grace-editor-show-spline" v-else-if="item.type == 'spline'">● ● ●</text>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import graceLink from "../../graceUI/components/graceLink.vue";
  21. export default{
  22. props:{
  23. article:{
  24. type : Array,
  25. default : function(){return new Array();}
  26. }
  27. },
  28. components:{
  29. graceLink
  30. },
  31. methods: {
  32. showImgs:function(e){
  33. var currentUrl = e.currentTarget.dataset.url;
  34. var imgs = [];
  35. var items = this.article;
  36. for(let i = 0; i < items.length; i++){
  37. if(items[i].type == 'img'){
  38. imgs.push(items[i].content);
  39. }
  40. }
  41. uni.previewImage({
  42. urls:imgs,
  43. current:currentUrl
  44. })
  45. }
  46. }
  47. }
  48. </script>
  49. <style scoped>
  50. .grace-editor-show{}
  51. .grace-editor-show-item{line-height:1.8em; letter-spacing:1px; font-size:0;}
  52. .grace-editor-show-txt{line-height:52rpx; font-size:26rpx; color:#333333;}
  53. .grace-editor-show-image{width:100%; margin:10rpx 0;}
  54. .grace-editor-show-quote{margin:10rpx 0; width:92%; color:#333333; background:#F8F8F8; line-height:36rpx; font-size:26rpx; padding:20rpx 4%; display:block;}
  55. .grace-editor-show-strong{font-weight:bold; width:100%; font-size:30rpx; line-height:45rpx; padding:10px 0; color:#3D3D3D; display:block;}
  56. .grace-editor-show-spline{padding:10px 0; display:block; text-align:center; line-height:50rpx; color:#8788A3; font-size:20rpx; opacity:0.3;}
  57. .grace-editor-show-center{text-align:center; font-size:28rpx; color:#333333; line-height:60rpx; padding:15rpx; border-bottom:1px solid #C1C1C1; font-weight:bold;}
  58. .grace-editor-show-link{line-height:32rpx; padding:10px 0; color:#007AFF;}
  59. </style>