我試圖使用命令欄ng-office-ui-fabric,並修改了寬度uif-contextextual-menu-item
。這裏是一個code上下文菜單的寬度
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/2.6.3/css/fabric.min.css" />
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/2.6.3/css/fabric.components.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/ngOfficeUiFabric/0.15.3/ngOfficeUiFabric.min.js"></script>
<style>
.menu1.ms-ContextualMenu {
width: 110px
}
</style>
</head>
<body ng-app="YourApp">
<div ng-controller="YourController">
<uif-command-bar>
<uif-command-bar-main>
<uif-command-bar-item>
<span>14</span>
<uif-icon uif-type="chevronDown"></uif-icon>
<uif-contextual-menu uif-is-open="true" class="menu1">
<uif-contextual-menu-item uif-text="'add'"></uif-contextual-menu-item>
<uif-contextual-menu-item uif-text="'minus'"></uif-contextual-menu-item>
<uif-contextual-menu-item uif-type="subMenu">
<uif-content>Versions</uif-content>
<uif-contextual-menu uif-is-open="true">
<uif-contextual-menu-item uif-text="'1'"></uif-contextual-menu-item>
<uif-contextual-menu-item uif-text="'2'"></uif-contextual-menu-item>
</uif-contextual-menu>
</uif-contextual-menu-item>
</uif-contextual-menu>
</uif-command-bar-item>
</uif-command-bar-main>
</uif-command-bar>
</div>
<script type="text/javascript">
angular.module('YourApp', ['officeuifabric.core', 'officeuifabric.components'])
.controller('YourController', ['$scope', function ($scope) {}])
</script>
</body>
</html>
正如你所看到的,我設法.menu1.ms-ContextualMenu
修改第一菜單的寬度(因爲它太大了),但子菜單的位置成爲uncorrect。有誰知道如何解決這一問題?您jsbin
.ms-ContextualMenu-link.ms-ContextualMenu-link--hasMenu ~ .ms-ContextualMenu {
left: 108px;
}
修改: