Advertising.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <!-- 广告位 -->
  3. <div class="adversing">
  4. <div class="inner">
  5. <a href="http://www.baidu.com">
  6. <!-- <img :src="imgurl.thumb" alt=""> -->
  7. <img :src="imgurl.thumb" v-if="!imgurl.image_src">
  8. <img :src="imgurl.image_src" v-if="imgurl.image_src">
  9. </a>
  10. </div>
  11. <p>{{ message }}</p>
  12. </div>
  13. </template>
  14. <script setup>
  15. import { onMounted } from 'vue'
  16. const nuxtApp = useNuxtApp();
  17. const axios = nuxtApp.$axios;
  18. const props = defineProps({
  19. imgurl: String
  20. });
  21. let image = useState("image", () => "")
  22. let getWebsiteAdvertisement = async () => {
  23. try {
  24. const response = await axios.get(`/web/getWebsiteAdvertisement?adPlace=${9}`);
  25. console.log(response);
  26. image.value = response.data;
  27. } catch (error) {
  28. console.error(error);
  29. }
  30. }
  31. onMounted(() => {
  32. getWebsiteAdvertisement()
  33. })
  34. </script>
  35. <style lang="less">
  36. // 广告位logo
  37. .adversing {
  38. width: 100%;
  39. height: 90px;
  40. margin: 60px 0 60px;
  41. img {
  42. width: 1200px;
  43. height: 90px;
  44. }
  45. }
  46. </style>