about.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <route lang="jsonc" type="page">
  2. {
  3. "layout": "tabbar",
  4. "style": {
  5. "navigationBarTitleText": "关于"
  6. }
  7. }
  8. </route>
  9. <script lang="ts" setup>
  10. import RequestComp from './components/request.vue'
  11. // 奇怪:同样的代码放在 vue 里面不会校验到错误,放在 .ts 文件里面会校验到错误
  12. // const testOxlint = (name: string) => {
  13. // console.log('oxlint')
  14. // }
  15. // testOxlint('oxlint')
  16. console.log('about')
  17. function gotoAlova() {
  18. uni.navigateTo({
  19. url: '/pages/about/alova',
  20. })
  21. }
  22. function gotoVueQuery() {
  23. uni.navigateTo({
  24. url: '/pages/about/vue-query',
  25. })
  26. }
  27. function gotoSubPage() {
  28. uni.navigateTo({
  29. url: '/pages-sub/demo/index',
  30. })
  31. }
  32. // uniLayout里面的变量通过 expose 暴露出来后可以在 onReady 钩子获取到(onLoad 钩子不行)
  33. const uniLayout = ref()
  34. onLoad(() => {
  35. console.log('onLoad:', uniLayout.value) // onLoad: undefined
  36. })
  37. onReady(() => {
  38. console.log('onReady:', uniLayout.value) // onReady: Proxy(Object)
  39. console.log('onReady:', uniLayout.value.testUniLayoutExposedData) // onReady: testUniLayoutExposedData
  40. })
  41. </script>
  42. <template>
  43. <view>
  44. <view class="mt-8 text-center text-xl text-gray-400">
  45. 组件使用、请求调用、unocss、static图片
  46. </view>
  47. <view class="my-2 text-center">
  48. <image src="/static/images/avatar.jpg" class="h-100px w-100px" />
  49. </view>
  50. <RequestComp />
  51. <view class="mb-6 h-1px bg-#eee" />
  52. <view class="text-center">
  53. <button type="primary" size="mini" class="w-160px" @click="gotoAlova">
  54. 前往 alova 示例页面
  55. </button>
  56. </view>
  57. <view class="text-center">
  58. <button type="primary" size="mini" class="w-160px" @click="gotoVueQuery">
  59. vue-query 示例页面
  60. </button>
  61. </view>
  62. <view class="text-center">
  63. <button type="primary" size="mini" class="w-160px" @click="gotoSubPage">
  64. 前往分包页面
  65. </button>
  66. </view>
  67. <view class="mt-6 text-center text-sm">
  68. <view class="inline-block w-80% text-gray-400">
  69. 为了方便脚手架动态生成不同UI模板,本页的按钮统一使用UI库无关的原生button
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <style lang="scss" scoped>
  75. .test-css {
  76. // 16rpx=>0.5rem
  77. padding-bottom: 16rpx;
  78. // mt-4=>1rem=>16px;
  79. margin-top: 16px;
  80. text-align: center;
  81. }
  82. </style>