refactor(dashboard): dashboard.vue 改用 <script setup> 语法
代码评审发现 Options API 与项目 30+ 个页面(square.vue、 discover.vue、exhibition.vue 等)惯例不一致。改写为 <script setup>,并把 pageBg 提到模块顶层(不再通过 setup return 传递)。Header 组件无 script 逻辑,无需改动。
This commit is contained in:
parent
282eb72e46
commit
b31cf01da4
@ -23,14 +23,13 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup>
|
||||||
import { ref, onUnmounted } from 'vue'
|
import { ref, onUnmounted } from 'vue'
|
||||||
import DashboardHeader from './components/DashboardHeader.vue'
|
import DashboardHeader from './components/DashboardHeader.vue'
|
||||||
import { useDashboardData } from '@/composables/useDashboardData'
|
import { useDashboardData } from '@/composables/useDashboardData'
|
||||||
|
|
||||||
export default {
|
const pageBg = 'linear-gradient(153deg, #FF9597 0%, #80DFFF 33%, #B8B8B8 74%, #D9D9D9 100%)'
|
||||||
components: { DashboardHeader },
|
|
||||||
setup() {
|
|
||||||
const activeTab = ref('crystal')
|
const activeTab = ref('crystal')
|
||||||
const starId = ref(uni.getStorageSync('star_id') || null)
|
const starId = ref(uni.getStorageSync('star_id') || null)
|
||||||
|
|
||||||
@ -45,18 +44,6 @@ export default {
|
|||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
dispose()
|
dispose()
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
|
||||||
activeTab,
|
|
||||||
loading,
|
|
||||||
error,
|
|
||||||
data,
|
|
||||||
isReady,
|
|
||||||
handleTabChange,
|
|
||||||
pageBg: 'linear-gradient(153deg, #FF9597 0%, #80DFFF 33%, #B8B8B8 74%, #D9D9D9 100%)',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user