NewsDetails.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <div class="NewsDetails">
  3. <banner img="../assets/img/bgtop.jpg" />
  4. <div class="NewsDetails-product">
  5. <div class="NewsDetails-product-content">
  6. <img v-lazy="imgserver+newsIdList.Img" alt />
  7. <p class="product-title">{{newsIdList.Title}}</p>
  8. <p class="product-time">{{newsIdList.CreateTime}}</p>
  9. <p class="product-content">{{newsIdList.Content}}</p>
  10. </div>
  11. </div>
  12. </div>
  13. </template>
  14. <script>
  15. import Banner from "../components/Banner";
  16. export default {
  17. name: "NewsDetails",
  18. components: {
  19. Banner
  20. },
  21. data() {
  22. return {
  23. pid: 0,
  24. newsIdList: {}
  25. };
  26. },
  27. created() {
  28. this.pid = this.$route.params.id;
  29. window.console.log(this.pid);
  30. },
  31. mounted() {
  32. this.loadData();
  33. },
  34. methods: {
  35. loadData() {
  36. this.$http
  37. .get(`News/GetNewsById/${this.pid}`)
  38. .then(response => {
  39. //console.log(response);
  40. this.newsIdList = response.data;
  41. window.console.log(this.newsIdList);
  42. })
  43. .catch(function(error) {
  44. window.console.log(error);
  45. });
  46. }
  47. }
  48. };
  49. </script>
  50. <style lang="scss" scoped>
  51. .NewsDetails {
  52. width: 100%;
  53. height: 100%;
  54. //overflow: hidden;
  55. background-color: #14679f;
  56. &-product {
  57. width: 1240px;
  58. margin: 0 auto;
  59. background-color: #fff;
  60. border: 1px solid red;
  61. &-content {
  62. width: 760px;
  63. margin: 0 auto;
  64. display: flex;
  65. flex-direction: column;
  66. align-items: flex-start;
  67. padding: 50px 0;
  68. img {
  69. width: 100%;
  70. //height: 500px;
  71. }
  72. .product-title {
  73. font-size: 25px;
  74. color: #e13834;
  75. padding: 20px 0;
  76. }
  77. .product-content {
  78. font-size: 17px;
  79. font-weight: bolder;
  80. padding: 20px 0;
  81. }
  82. }
  83. }
  84. }
  85. </style>