123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <template>
- <mobile-frame>
- <view class="main">
- <view class="one">
- <button size="mini" @click="toCommon('pages/login/index')">登录页面</button>
- <button size="mini" @click="toCommon('pages/home/index')">首页</button>
- <button size="mini" @click="toCommon('pages/store/index')">微店</button>
- <button size="mini" @click="toCommon('pages/week/index')">周边</button>
- <button size="mini" @click="toCommon('pages/market/index')">购物车</button>
- <button size="mini" @click="toCommon('pages/my/index')">我的1</button>
- </view>
- <view class="two">
- <tabs :tabs="tabs" @tabsChange="tabsChange">
- <view v-show="tabs.active=='a'">1</view>
- <view v-show="tabs.active=='b'">2</view>
- <view v-show="tabs.active=='c'">3</view>
- <view v-show="tabs.active=='d'">4</view>
- <view v-show="tabs.active=='e'">5</view>
- </tabs>
- </view>
- </view>
- </mobile-frame>
- </template>
- <script>
- import tabs from '@/components/tabs/index.vue';
- export default {
- components: {
- tabs
- },
- data() {
- return {
- tabs: {
- active: 'a',
- menu: [ //菜单列表
- {
- title: '选项卡一',
- active: 'a'
- },
- {
- title: '选项卡二',
- active: 'b'
- },
- {
- title: '选项卡三',
- active: 'c'
- },
- {
- title: '选项卡四',
- active: 'd'
- },
- {
- title: '选项卡五',
- active: 'e'
- }
- ]
- }
- };
- },
- onShow: function() {
- const that = this;
- // 监听用户是否登录
- that.watchLogin();
- },
- methods: {
- // 公共跳转
- toCommon(e) {
- uni.navigateTo({
- url: `/${e}`
- });
- },
- watchLogin() {
- uni.redirectTo({
- url: `/pages/home/index`
- })
- },
- tabsChange(e) {
- const that = this;
- that.$set(that.tabs, `active`, e.active)
- }
- }
- }
- </script>
- <style lang="scss">
- .main {
- .one {
- text-align: center;
- button {
- margin: 2vw;
- }
- }
- .two {
- padding: 2vw;
- .scrollView {
- display: flex;
- white-space: nowrap;
- text-align: center;
- }
- .list {
- display: inline-block;
- padding: 2vw;
- margin: 0 1.5vw;
- text-align: center;
- border-radius: 5px;
- text {
- font-weight: bold;
- font-size: var(--font14Size);
- }
- }
- }
- }
- </style>
|