26 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-12-08 17:39:09 +08:00
import { ref, onMounted, shallowRef, watchEffect, watch } from 'vue';
// 动态获取图片
2023-12-12 19:39:15 +08:00
const getAssetsImages = (url) => {
// return new URL(url, import.meta.url).href
return 'https://ts1.cn.mm.bing.net/th?id=OIP-C.7pldmOaHsIlsAGsWmA4SawHaE8&w=306&h=204&c=8&rs=1&qlt=90&o=6&pid=3.1&rm=2'
}
2023-12-08 17:39:09 +08:00
export function userData() {
const selectNav = ref<number>(1)
const navItem = ref<any>([{ text: '关注', id: 0 }, { text: '发现', id: 1 }, { text: '活动', id: 2 }, { text: '闲置', id: 3 }, { text: '二手车', id: 4 }])
const handSelectNav = function (index : number) {
selectNav.value = index
}
2023-12-12 19:39:15 +08:00
const refresherrestore = function () {
console.log(333)
}
const topicList = ref<any>([{ url: [getAssetsImages('../../../static/common/112.webp')] }, { url: [getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp')] }, { url: [getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp')] }, { url: [getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp')] }, { url: [getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp'), getAssetsImages('../../../static/common/112.webp')] }])
2023-12-08 17:39:09 +08:00
return {
selectNav,
navItem,
2023-12-12 19:39:15 +08:00
handSelectNav,
refresherrestore,
topicList
2023-12-08 17:39:09 +08:00
}
}