AppMenu.san 1.6 KB
Newer Older
B
BingBlog 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
<template>
    <div class="visual-dl-app-menu">
        <san-appbar title="VisualDL">
            <san-menu slot="right">
                <san-menu-item
                    san-for="item in items"
                    class="{{selected === item.value ? 'sm-menu-item-selected' : ''}}"
                    on-click="handleItemClick(item)"
                    title="{{item.title}}" />
            </san-menu>
        </san-appbar>
    </div>
</template>

<script>
import Appbar from 'san-mui/AppBar';
import {MenuItem, Menu} from 'san-mui/Menu';
export default {
    components: {
        'san-appbar': Appbar,
        'san-menu': Menu,
        'san-menu-item': MenuItem
    },
    initData() {
        return {
            selected: '1',
            items: [
                {
                    value: '1',
                    url: '/scalars',
                    title: 'SCALARS'
                },
                {
                    value: '2',
                    url: '/image',
                    title: 'IMAGES'
                }
            ]
        };
    },
    handleItemClick(item) {
        this.data.set('selected', item.value);
        this.fire('item-click', item);
    }
};
</script>
<style lang="stylus">
@import '../../style/variables';

+prefix-classes(prefix)
    .app-menu
        width 100%

.visual-dl-app-menu
    .sm-appbar-title
        flex none
    .sm-appbar-right
        width 100%
        .sm-menu
            width 100%
            height 100%
            display flex
            flex-direction row
            .sm-menu-item-selected
                background #e4e4e4
</style>