既然您已经打包并上传了。你不能在 SPO 网站上做到这一点。您需要编辑 manifest.json 文件。您可以添加 "supportsFullBleed": true 为您的 Web 部件启用全宽列。并再次打包、上传并安装到目录中。
这样做的缺点是无法在本地工作台中测试全宽 Web 部件。你必须在网上的SP上做。你可以找到参考here。
{
"$schema": "https://dev.office.com/json-schemas/spfx/client-side-web-part-manifest.schema.json",
"id": "34f6d7f2-262f-460a-8b65-152d784127cb",
"alias": "HelloWorldWebPart",
"componentType": "WebPart",
// The "*" signifies that the version should be taken from the package.json
"version": "*",
"manifestVersion": 2,
// If true, the component can only be installed on sites where Custom Script is allowed.
// Components that allow authors to embed arbitrary script code should set this to true.
// https://support.office.com/en-us/article/Turn-scripting-capabilities-on-or-off-1f2c515f-5d7e-448a-9fd7-835da935584f
"requiresCustomScript": false,
"supportsFullBleed": true,
"preconfiguredEntries": [{
"groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
"group": { "default": "Other" },
"title": { "default": "HelloWorld" },
"description": { "default": "HelloWorld description" },
"officeFabricIconFontName": "Page",
"properties": {
"description": "HelloWorld"
}
}]
}
您还可以使用 SharePoint 2013 和 Office 365 中默认存在的 Oslo 母版页。要更改母版页,如果您使用协作网站,则需要激活发布功能,并且需要使用自定义 css删除多余的边距。
.contentwrapper {
margin: 0;
}
#titleAreaBox {
margin: auto 20px!important;
}