Advertising.vue 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. </a>
  8. </div>
  9. <p>{{ message }}</p>
  10. </div>
  11. </template>
  12. <script setup>
  13. import { onMounted } from 'vue'
  14. const nuxtApp = useNuxtApp();
  15. const axios = nuxtApp.$axios;
  16. const props = defineProps({
  17. imgurl: String
  18. });
  19. let image = useState("image", () => "")
  20. let getWebsiteAdvertisement = async () => {
  21. try {
  22. const response = await axios.get(`/web/getWebsiteAdvertisement?adPlace=${9}`);
  23. console.log(response);
  24. image.value = response.data;
  25. } catch (error) {
  26. console.error(error);
  27. }
  28. }
  29. onMounted(() => {
  30. getWebsiteAdvertisement()
  31. })
  32. </script>
  33. <style lang="less">
  34. // 广告位logo
  35. .adversing {
  36. width: 100%;
  37. height: 90px;
  38. margin: 60px 0 60px;
  39. img {
  40. width: 1200px;
  41. height: 90px;
  42. }
  43. }
  44. </style>