|
@@ -0,0 +1,106 @@
|
|
|
|
+<template>
|
|
|
|
+ <div
|
|
|
|
+ class="category-container">
|
|
|
|
+ <div
|
|
|
|
+ class="cate-header">
|
|
|
|
+ <van-tabs
|
|
|
|
+ v-model="cateValue"
|
|
|
|
+ :color="'#ee0a24'"
|
|
|
|
+ :background="'#fff'">
|
|
|
|
+ <van-tab
|
|
|
|
+ v-for="index in 8"
|
|
|
|
+ :key="index">
|
|
|
|
+ <template #title>
|
|
|
|
+ <van-icon
|
|
|
|
+ name="more-o"/>
|
|
|
|
+ 选项
|
|
|
|
+ </template>
|
|
|
|
+ 内容 {{ index }}
|
|
|
|
+ </van-tab>
|
|
|
|
+ </van-tabs>
|
|
|
|
+ <van-dropdown-menu
|
|
|
|
+ class="fbt-van-dropdown-menu">
|
|
|
|
+ <van-dropdown-item
|
|
|
|
+ title="筛选"
|
|
|
|
+ ref="item">
|
|
|
|
+ <p>111</p>
|
|
|
|
+ <p>222</p>
|
|
|
|
+ </van-dropdown-item>
|
|
|
|
+ </van-dropdown-menu>
|
|
|
|
+ </div>
|
|
|
|
+ <van-button
|
|
|
|
+ type="primary" :to="'/category/detail'">去详情页
|
|
|
|
+ </van-button>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { Tab, Tabs, Button, Icon, DropdownMenu, DropdownItem, Toast } from 'vant'
|
|
|
|
+import { apiCateList } from './api/api'
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: 'index',
|
|
|
|
+ components: {
|
|
|
|
+ 'van-tabs': Tabs,
|
|
|
|
+ 'van-tab': Tab,
|
|
|
|
+ 'van-icon': Icon,
|
|
|
|
+ 'van-dropdown-menu': DropdownMenu,
|
|
|
|
+ 'van-dropdown-item': DropdownItem,
|
|
|
|
+ 'van-button': Button
|
|
|
|
+ },
|
|
|
|
+ data () {
|
|
|
|
+ return {
|
|
|
|
+ cateValue: 0
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ activated () {
|
|
|
|
+ if (!this.$route.meta.isUseCache) {
|
|
|
|
+ this.fetchCateList()
|
|
|
|
+ }
|
|
|
|
+ this.$route.meta.isUseCache = false
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ async fetchCateList () {
|
|
|
|
+ try {
|
|
|
|
+ const { status, data, msg } = await apiCateList()
|
|
|
|
+ if (status) {
|
|
|
|
+ console.log(data)
|
|
|
|
+ } else {
|
|
|
|
+ Toast(msg)
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.category-container {
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 0;
|
|
|
|
+ top: 0;
|
|
|
|
+ right: 0;
|
|
|
|
+ bottom: 0;
|
|
|
|
+ width: 100%;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.cate-header {
|
|
|
|
+ position: relative;
|
|
|
|
+ left: 0;
|
|
|
|
+ top: 0;
|
|
|
|
+ width: 100%;
|
|
|
|
+
|
|
|
|
+ .fbt-van-dropdown-menu {
|
|
|
|
+ position: absolute;
|
|
|
|
+ right: 0;
|
|
|
|
+ top: 0;
|
|
|
|
+ width: 100px;
|
|
|
|
+
|
|
|
|
+ ::v-deep .van-dropdown-menu__title {
|
|
|
|
+ &::after {
|
|
|
|
+ visibility: hidden;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|