WebApp【公共组件库】@前端(For Git Submodule)
Tevin
2020-11-24 d0a11de9521c4323036e3ed6206f359b4e4534dc
调整目录结构
3 files added
3 files renamed
1 files modified
3 files deleted
247 ■■■■■ changed files
bases/Fetcher.js 4 ●●●● patch | view | raw | blame | history
h5/layout/index.js 14 ●●●●● patch | view | raw | blame | history
h5/layout/navBar/CNavBar.vue 41 ●●●●● patch | view | raw | blame | history
h5/layout/navBar/cNavBar.scss 26 ●●●●● patch | view | raw | blame | history
layout/h5/content/CContent.vue patch | view | raw | blame | history
layout/h5/index.js 14 ●●●●● patch | view | raw | blame | history
layout/h5/navBar/CNavBar.vue 69 ●●●●● patch | view | raw | blame | history
layout/h5/navBar/cNavBar.scss 79 ●●●●● patch | view | raw | blame | history
layout/h5/page/CPage.vue patch | view | raw | blame | history
layout/h5/page/cPage.scss patch | view | raw | blame | history
bases/Fetcher.js
@@ -482,8 +482,8 @@
        if (Tools.getTopUrlParam('query') === 'real') {
            return false;
        }
        // 当没有 url 指定时,只有内网 ip 和 35** 的端口号,视为本地开发模式
        return /^(192|127|localhost).*?:35\d{2}$/i.test(window.location.host);
        // 当没有 url 指定时,只有内网 ip 和 33** 的端口号,视为本地开发模式
        return /^(192|127|localhost).*?:33\d{2}$/i.test(window.location.host);
    })();
h5/layout/index.js
File was deleted
h5/layout/navBar/CNavBar.vue
File was deleted
h5/layout/navBar/cNavBar.scss
File was deleted
layout/h5/content/CContent.vue
layout/h5/index.js
New file
@@ -0,0 +1,14 @@
/**
 * layout
 * @author Tevin
 */
import CPage from '@components/layout/h5/page/CPage.vue';
import CNavBar from '@components/layout/h5/navBar/CNavBar.vue';
import CContent from '@components/layout/h5/content/CContent.vue';
export {
    CPage,
    CNavBar,
    CContent,
}
layout/h5/navBar/CNavBar.vue
New file
@@ -0,0 +1,69 @@
<template>
    <view class="c-nav-bar">
        <AtNavBar
            :title="title"
            leftIconType="chevron-left"
            :onClickLeftIcon="evt=>goBack()"
            :rightFirstIconType="dropNav ? 'bullet-list' : ''"
            :onClickRgIconSt="evt=>dropMenu()"
        />
        <view
            class="c-nav-bar-drop"
            v-show="dropShow"
        >
            <view class="inner">
                <view class="arrow"></view>
                <view class="box">
                    <view
                        class="item"
                        v-for="(nav,index) in dropNav"
                        :key="index"
                        @tap="evt=>goNav(nav)"
                    >{{nav.title}}</view>
                </view>
            </view>
        </view>
    </view>
</template>
<script>
import Taro from '@tarojs/taro';
import { AtNavBar } from 'taro-ui-vue';
import './cNavBar.scss';
export default {
    name: 'CNavBar',
    components: {
        AtNavBar,
    },
    props: {
        title: String,
        dropNav: Array,
    },
    data() {
        return {
            dropShow: false,
        };
    },
    methods: {
        goBack() {
            window.history.go(-1);
        },
        goNav(nav) {
            if (!nav.url) {
                return;
            }
            this.dropShow = false;
            let method = 'navigateTo';
            if (/navigate|redirect/.test(nav.method)) {
                method = nav.method + 'To';
            }
            Taro[method]({ url: nav.url });
        },
        dropMenu() {
            this.dropShow = !this.dropShow;
        },
    },
    mounted() {},
};
</script>
layout/h5/navBar/cNavBar.scss
New file
@@ -0,0 +1,79 @@
/**
 * nav-bar
 * @author Tevin
 */
@import "../../../common/sassMixin";
.c-nav-bar {
    position: relative;
    .at-nav-bar {
        background-color: #1e8ad2;
    }
    .at-nav-bar__left-view,
    .at-nav-bar__right-view,
    .at-nav-bar__title {
        color: #fff;
    }
    .at-nav-bar__left-view {
        &:active {
            background-color: rgba(#F0F0F0, 0.5);
            transition: background-color 0s;
        }
    }
    .at-nav-bar__container {
        width: 100%;
        text-align: right;
        &:active {
            background-color: rgba(#F0F0F0, 0.5);
            transition: background-color 0s;
        }
        .at-icon-bullet-list {
            margin-right: 6PX;
        }
    }
    .at-nav-bar__container--hide {
        display: none;
    }
    .c-nav-bar-drop {
        @include position(absolute, n n 0 0, 10);
        .inner {
            @include position(absolute, 0 n n 0);
            padding: 0.3rem;
            .arrow {
                @include position(absolute, 0.15rem n n 0.65rem);
                width: 0;
                height: 0;
                border-top: 0.6rem solid #f2f4f7;
                border-right: 0.6rem solid transparent;
                transform: rotate(45deg);
            }
            .box {
                position: relative;
                z-index: 2;
                width: 4rem;
                padding: 0.2rem 0;
                background-color: #f7f8fa;
                border-radius: 0.1rem;
                box-shadow: rgba(#000, 0.1) 0 1PX 1PX 1PX;
                .item {
                    padding: 0 0.4rem;
                    text-align: center;
                    line-height: 1.45rem;
                    font-size: 0.65rem;
                    @include ellipsis(100%);
                    box-sizing: border-box;
                    border-bottom: #edf0f8 1PX solid;
                    transition: background-color 0.3s;
                    &:active {
                        background-color: #fff;
                        transition: background-color 0s;
                    }
                    &:last-child {
                        border: none;
                    }
                }
            }
        }
    }
}
layout/h5/page/CPage.vue
layout/h5/page/cPage.scss