Clang-Format:让你的代码整齐划一,格式不再烦恼

在现代软件开发中,代码规范和一致性对团队协作和代码质量至关重要。如何保持代码风格一致,避免手动格式化的繁琐操作?clang-format 是一款强大而灵活的代码格式化工具,它为开发者提供了高效的解决方案。本文将详细介绍 clang-format 的概念、历史、功能、自动化使用方案(特别是在 VSCode 中),并给出完整的实例。

一、Clang-Format 概念

clang-format 是 LLVM 项目的一部分,是一种用于自动格式化 C、C++、Objective-C 及其他代码的工具。它可以根据用户指定的风格规则自动调整代码缩进、空格、对齐等,使代码在团队中保持一致的风格。其高度可配置性和广泛的编辑器支持,使其成为现代开发中流行的代码格式化工具之一。
在这里插入图片描述

二、Clang-Format 的历史

clang-format 最初是作为 LLVM 项目的一部分开发的,用于为 Clang 编译器提供一个标准化代码风格的工具。LLVM 项目始于 2000 年代初,旨在创建一个模块化和可重用的编译器基础架构,而 clang-format 则随着 Clang 编译器的发展逐渐演变。其目标是为开发人员提供一种简单的方式来保持代码一致性,避免手动格式化带来的不便。

随着开发者对代码质量和可维护性的重视,clang-format 在社区中迅速流行起来,不仅用于个人项目,也被广泛应用于企业和开源项目中。

三、Clang-Format 的作用与功能

clang-format 提供了强大的功能,涵盖了从基本代码缩进到高级格式选项的方方面面。以下是其主要功能:

  1. 自动格式化代码:根据用户配置自动调整代码缩进、对齐、空格和换行等,使代码符合指定的风格标准。
  2. 多语言支持:支持 C、C++、JavaScript、Objective-C、Java、Protobuf 等语言。
  3. 灵活的配置:通过 .clang-format 配置文件,可以自定义各种格式化选项,例如缩进宽度、列限制和对齐方式。
  4. 集成开发环境(IDE)支持clang-format 可以与主流 IDE 如 VSCode、CLion、Visual Studio 和 Vim 等无缝集成,使得开发者在编写代码时能自动格式化。
    在这里插入图片描述
    在这里插入图片描述
四、如何在 VSCode 中使用 Clang-Format 自动格式化代码

VSCode 是一款流行的编辑器,具有丰富的扩展功能,使其与 clang-format 结合使用时变得非常高效。以下是如何在 VSCode 中设置和使用 clang-format 的详细步骤。

1. 安装 clang-format

首先,确保系统中已安装 clang-format。你可以通过以下命令检查 clang-format 是否可用:

clang-format --version

如果未安装,可以通过以下命令进行安装:

  • Ubuntu/Debian
    sudo apt install clang-format
    
  • macOS
    brew install clang-format
    
2. 创建 .clang-format 配置文件

在项目的根目录创建一个 .clang-format 文件,该文件定义了格式化规则。例如:

BasedOnStyle: Google
IndentWidth: 4
ColumnLimit: 100
AlignConsecutiveAssignments: true
AlignTrailingComments: true

BasedOnStyle 可以设置为 LLVMGoogleChromiumMozilla 等预设风格,用户可以根据需求调整。
在这里插入图片描述

3. 在 VSCode 中配置自动格式化

在 VSCode 中,你可以通过设置文件 settings.jsonclang-format 自动运行。步骤如下:

  1. 打开 VSCode 的设置文件 settings.json,添加以下配置:

    "[cpp]": {
        "editor.defaultFormatter": "xaver.clang-format",
        "editor.formatOnSave": true
    }
    

    这将使 VSCode 在保存 C/C++ 文件时自动运行 clang-format

  2. 确保已安装 Clang-Format 扩展。你可以在 VSCode 的扩展市场中搜索并安装 Clang-Format 插件。

4. 手动运行格式化

如果不想在保存时自动格式化,可以手动运行 clang-format

  • 选中要格式化的代码片段,按 Shift + Alt + F,或右键选择“格式化文档”。
五、完整实例:在 VSCode 中自动格式化 C++ 项目

假设你有一个简单的 C++ 项目,目录结构如下:

project-root/
│
├── main.cpp
├── utils.cpp
├── utils.h
└── .clang-format
  1. 创建 .clang-format 文件:在 project-root/ 目录下创建 .clang-format 文件,添加以下内容:

    BasedOnStyle: LLVM
    IndentWidth: 4
    ColumnLimit: 80
    SortIncludes: true
    

    这将基于 LLVM 风格格式化代码,并使用 4 空格缩进,列宽限制为 80 字符。

  2. 编写示例代码:在 main.cpp 中编写一段未格式化的代码:

    #include <iostream>
    #include "utils.h"
    
    int main() {
    std::cout << "Hello, World!"<<std::endl;
    int result=add(5,10);
    std::cout<<"Result: "<<result<<std::endl;
    return 0;
    }
    
  3. 格式化代码:保存文件时,VSCode 会自动运行 clang-format,格式化后的代码如下:

    #include <iostream>
    #include "utils.h"
    
    int main() {
        std::cout << "Hello, World!" << std::endl;
        int result = add(5, 10);
        std::cout << "Result: " << result << std::endl;
        return 0;
    }
    
六、自动化方案的优势

使用 clang-format 自动格式化代码有以下优势:

  • 提高代码一致性:无论是谁编写代码,项目中的代码风格始终保持一致。
  • 减少代码审查时间:审查时不再关注代码格式问题,专注于逻辑和功能。
  • 提升开发效率:开发者无需手动调整代码格式,减少不必要的工作。
七、总结

clang-format 是一个不可或缺的工具,尤其在大型团队和项目中使用时能显著提高代码质量和可维护性。通过在 VSCode 中配置 clang-format,开发者可以实现代码的自动格式化,从而专注于编写高质量代码而不是格式问题。希望本文能帮助你在项目中轻松集成 clang-format,让代码格式化变得简单而高效。

/eap/.clang-format: line 1: BasedOnStyle:: command not found /eap/.clang-format: line 2: Language:: command not found /eap/.clang-format: line 3: AccessModifierOffset:: command not found /eap/.clang-format: line 4: AlignAfterOpenBracket:: command not found /eap/.clang-format: line 5: AlignConsecutiveAssignments:: command not found /eap/.clang-format: line 6: AlignConsecutiveDeclarations:: command not found /eap/.clang-format: line 7: AlignOperands:: command not found /eap/.clang-format: line 8: AlignTrailingComments:: command not found /eap/.clang-format: line 9: AllowAllArgumentsOnNextLine:: command not found /eap/.clang-format: line 10: AllowAllParametersOfDeclarationOnNextLine:: command not found /eap/.clang-format: line 11: AllowShortFunctionsOnASingleLine:: command not found /eap/.clang-format: line 12: AllowShortIfStatementsOnASingleLine:: command not found /eap/.clang-format: line 13: AlwaysBreakAfterDefinitionReturnType:: command not found /eap/.clang-format: line 14: AlwaysBreakAfterReturnType:: command not found /eap/.clang-format: line 15: AlwaysBreakBeforeMultilineStrings:: command not found /eap/.clang-format: line 16: AlwaysBreakTemplateDeclarations:: command not found /eap/.clang-format: line 17: BinPackArguments:: command not found /eap/.clang-format: line 18: BinPackParameters:: command not found /eap/.clang-format: line 19: $'BraceWrapping:\r': command not found /eap/.clang-format: line 20: AfterCaseLabel:: command not found /eap/.clang-format: line 21: AfterClassKeyword:: command not found /eap/.clang-format: line 22: AfterControlStatement:: command not found /eap/.clang-format: line 23: AfterEnumKeyword:: command not found /eap/.clang-format: line 24: AfterFunctionKeyword:: command not found /eap/.clang-format: line 25: AfterNamespaceKeyword:: command not found /eap/.clang-format: line 26: AfterStructKeyword:: command not found /eap/.clang-format: line 27: AfterUnionKeyword:: command not found /eap/.clang-format: line 28: AfterCXXCatchKeyword:: command not found /eap/.clang-format: line 29: AfterElse:: command not found /eap/.clang-format: line 30: BeforeElse:: command not found /eap/.clang-format: line 31: BeforeWhile:: command not found /eap/.clang-format: line 32: BreakBeforeBinaryOperators:: command not found /eap/.clang-format: line 33: BreakBeforeBraces:: command not found /eap/.clang-format: line 34: BreakBeforeTernaryOperators:: command not found /eap/.clang-format: line 35: BreakConstructorInitializersBeforeComma:: command not found /eap/.clang-format: line 36: BreakInheritanceListBeforeComma:: command not found /eap/.clang-format: line 37: BreakInheritanceListBeforeColon:: command not found /eap/.clang-format: line 38: BreakStringLiterals:: command not found /eap/.clang-format: line 39: ColumnLimit:: command not found /eap/.clang-format: line 40: CommentPragmas:: command not found /eap/.clang-format: line 41: ConstructorInitializerAllOnOneLineOrOnePerLine:: command not found /eap/.clang-format: line 42: ConstructorInitializerIndentWidth:: command not found /eap/.clang-format: line 43: ContinuationIndentWidth:: command not found /eap/.clang-format: line 44: Cpp11BracedListStyle:: command not found /eap/.clang-format: line 45: DerivePointerAlignment:: command not found /eap/.clang-format: line 46: DisableFormat:: command not found /eap/.clang-format: line 47: ExperimentalAutoDetectBinPacking:: command not found /eap/.clang-format: line 48: FixNamespaceComments:: command not found /eap/.clang-format: line 49: $'ForEachMacros:\r': command not found /eap/.clang-format: line 50: -: command not found /eap/.clang-format: line 51: -: command not found /eap/.clang-format: line 52: -: command not found /eap/.clang-format: line 53: $'IncludeCategories:\r': command not found /eap/.clang-format: line 54: -: command not found /eap/.clang-format: line 55: Priority:: command not found /eap/.clang-format: line 56: -: command not found /eap/.clang-format: line 57: Priority:: command not found /eap/.clang-format: line 58: -: command not found /eap/.clang-format: line 59: Priority:: command not found /eap/.clang-format: line 60: IncludeIsMainRegex:: command not found /eap/.clang-format: line 61: IndentCaseLabels:: command not found /eap/.clang-format: line 62: IndentCaseBlocks:: command not found /eap/.clang-format: line 63: IndentGotoLabels:: command not found /eap/.clang-format: line 64: IndentPPDirectives:: command not found /eap/.clang-format: line 65: IndentWidth:: command not found /eap/.clang-format: line 66: IndentWrappedFunctionNames:: command not found /eap/.clang-format: line 67: JavaScriptQuotes:: command not found /eap/.clang-format: line 68: JavaScriptRegex:: command not found /eap/.clang-format: line 69: KeepEmptyLinesAtTheStartOfBlocks:: command not found /eap/.clang-format: line 70: MacroBlockBegin:: command not found /eap/.clang-format: line 71: MacroBlockEnd:: command not found /eap/.clang-format: line 72: MaxEmptyLinesToKeep:: command not found /eap/.clang-format: line 73: NamespaceIndentation:: command not found /eap/.clang-format: line 74: ObjCBlockIndentWidth:: command not found /eap/.clang-format: line 75: ObjCSpaceAfterProperty:: command not found /eap/.clang-format: line 76: ObjCSpaceBeforeProtocolList:: command not found /eap/.clang-format: line 77: PenaltyBreakAssignment:: command not found /eap/.clang-format: line 78: PenaltyBreakBeforeFirstCallParameter:: command not found /eap/.clang-format: line 79: PenaltyBreakComment:: command not found /eap/.clang-format: line 80: PenaltyBreakFirstLessLess:: command not found /eap/.clang-format: line 81: PenaltyBreakString:: command not found /eap/.clang-format: line 82: PenaltyBreakTemplateDeclaration:: command not found /eap/.clang-format: line 83: PenaltyExcessCharacter:: command not found /eap/.clang-format: line 84: PenaltyReturnTypeOnItsOwnLine:: command not found /eap/.clang-format: line 85: PointerAlignment:: command not found /eap/.clang-format: line 86: ReflowComments:: command not found /eap/.clang-format: line 87: SortIncludes:: command not found /eap/.clang-format: line 88: SortUsingDeclarations:: command not found /eap/.clang-format: line 89: SpaceAfterCStyleCast:: command not found /eap/.clang-format: line 90: SpaceAfterLogicalNot:: command not found /eap/.clang-format: line 91: SpaceAfterTemplateKeyword:: command not found /eap/.clang-format: line 92: SpaceBeforeAssignmentOperators:: command not found /eap/.clang-format: line 93: SpaceBeforeCaseColon:: command not found /eap/.clang-format: line 94: SpaceBeforeCpp11BracedList:: command not found /eap/.clang-format: line 95: SpaceBeforeCtorColon:: command not found /eap/.clang-format: line 96: SpaceBeforeInheritanceColon:: command not found /eap/.clang-format: line 97: SpaceBeforeKeywords:: command not found /eap/.clang-format: line 98: SpaceBeforeParens:: command not found /eap/.clang-format: line 99: SpaceBeforeRangeBasedForLoopColon:: command not found /eap/.clang-format: line 100: SpaceInEmptyParentheses:: command not found /eap/.clang-format: line 101: SpacesBeforeTrailingComments:: command not found /eap/.clang-format: line 102: SpacesInAngles:: command not found /eap/.clang-format: line 103: SpacesInContainerLiterals:: command not found /eap/.clang-format: line 104: SpacesInCStyleCastParentheses:: command not found /eap/.clang-format: line 105: SpacesInParentheses:: command not found /eap/.clang-format: line 106: SpacesInSquareBrackets:: command not found /eap/.clang-format: line 107: Standard:: command not found /eap/.clang-format: line 108: $'StatementMacros:\r': command not found /eap/.clang-format: line 109: -: command not found /eap/.clang-format: line 110: -: command not found /eap/.clang-format: line 111: -: command not found /eap/.clang-format: line 112: -: command not found /eap/.clang-format: line 113: -: command not found /eap/.clang-format: line 114: -: command not found /eap/.clang-format: line 115: -: command not found /eap/.clang-format: line 116: -: command not found /eap/.clang-format: line 117: -: command not found /eap/.clang-format: line 118: -: command not found /eap/.clang-format: line 119: -: command not found /eap/.clang-format: line 120: -: command not found /eap/.clang-format: line 121: -: command not found /eap/.clang-format: line 122: -: command not found /eap/.clang-format: line 123: -: command not found /eap/.clang-format: line 124: -: command not found /eap/.clang-format: line 125: -: command not found /eap/.clang-format: line 126: -: command not found /eap/.clang-format: line 127: -: command not found /eap/.clang-format: line 128: -: command not found /eap/.clang-format: line 129: -: command not found /eap/.clang-format: line 130: -: command not found /eap/.clang-format: line 131: -: command not found /eap/.clang-format: line 132: -: command not found /eap/.clang-format: line 133: -: command not found /eap/.clang-format: line 134: -: command not found /eap/.clang-format: line 135: -: command not found /eap/.clang-format: line 136: -: command not found /eap/.clang-format: line 137: -: command not found /eap/.clang-format: line 138: -: command not found /eap/.clang-format: line 139: -: command not found /eap/.clang-format: line 140: -: command not found /eap/.clang-format: line 141: -: command not found /eap/.clang-format: line 142: -: command not found /eap/.clang-format: line 143: -: command not found /eap/.clang-format: line 144: -: command not found /eap/.clang-format: line 145: -: command not found /eap/.clang-format: line 146: -: command not found /eap/.clang-format: line 147: -: command not found /eap/.clang-format: line 148: -: command not found /eap/.clang-format: line 149: -: command not found /eap/.clang-format: line 150: -: command not found /eap/.clang-format: line 151: -: command not found /eap/.clang-format: line 152: -: command not found /eap/.clang-format: line 153: -: command not found /eap/.clang-format: line 154: -: command not found /eap/.clang-format: line 155: -: command not found /eap/.clang-format: line 156: TabWidth:: command not found /eap/.clang-format: line 157: UseCRLF:: command not found /eap/.clang-format: line 158: UseTab:: command not found /eap/.clang-format: line 159: $'WhitespaceSensitiveMacros:\r': command not found /eap/.clang-format: line 160: -: command not found /eap/.clang-format: line 161: -: command not found
08-19
你遇到的错误信息如下: ``` /eap/.clang-format: line 1: BasedOnStyle:: command not found ... ``` 这表明你当前的 `.clang-format` 文件被系统**当作 shell 脚本执行了**,而不是被 `clang-format` 工具解析为配置文件。这是由于 `.clang-format` 文件的**格式不正确或文件编码/换行符有误**。 --- ## 🔍 问题原因分析: 你复制的 `.clang-format` 文件中,每一行看起来像这样: ``` BasedOnStyle: Google Language: Cpp AlignAfterOpenBracket: Align ... ``` 但系统却把它当成了 shell 命令: ``` BasedOnStyle:: command not found ``` 这通常是因为: ### ❌ 错误方式: 你可能**手动创建了一个 `.clang-format` 文件并粘贴了内容,但文件格式不对**,比如: - 文件被保存为 **可执行脚本**(例如误加了 `#!/bin/bash`) - 文件的**换行符是 Windows 风格(CRLF)**,而你在 Linux 环境下运行 - 文件被保存为错误的编码格式(如 UTF-8 with BOM) --- ## ✅ 正确做法:创建 `.clang-format` 文件 ### ✅ 方法一:使用 `clang-format` 自动生成 你可以使用 `clang-format` 自带的命令生成一个默认的 `.clang-format` 文件: ```bash clang-format -style=LLVM -dump-config > .clang-format ``` 然后你可以用文本编辑器打开 `.clang-format`,手动修改为你需要的格式风格(比如缩进为 4、BraceWrapping 设置为 Stroustrup 等)。 --- ### ✅ 方法二:正确粘贴配置内容 请确保你复制的 `.clang-format` 内容是纯文本格式,并且保存为 UTF-8 编码,**无 BOM**,**换行符为 LF(Unix)**。 #### ✅ 推荐做法: 1. 使用 VS Code 或其他编辑器新建 `.clang-format` 文件; 2. 将以下内容粘贴进去(这是你之前提供的配置,但修正了格式): ```yaml BasedOnStyle: Google Language: Cpp AccessModifierOffset: -4 AlignAfterOpenBracket: Align AlignConsecutiveAssignments: true AlignConsecutiveDeclarations: true AlignOperands: true AlignTrailingComments: true AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes BinPackArguments: true BinPackParameters: true BraceWrapping: AfterCaseLabel: false AfterClassKeyword: false AfterControlStatement: Never AfterEnumKeyword: false AfterFunctionKeyword: false AfterNamespaceKeyword: false AfterStructKeyword: false AfterUnionKeyword: false AfterCXXCatchKeyword: false AfterElse: false BeforeElse: false BeforeWhile: false BreakBeforeBinaryOperators: NonAssignment BreakBeforeBraces: Stroustrup BreakBeforeTernaryOperators: true BreakConstructorInitializersBeforeComma: false BreakInheritanceListBeforeComma: true BreakInheritanceListBeforeColon: true BreakStringLiterals: true ColumnLimit: 100 CommentPragmas: '^ IWYU pragma:' ConstructorInitializerAllOnOneLineOrOnePerLine: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false FixNamespaceComments: true ForEachMacros: - foreach - Q_FOREACH - BOOST_FOREACH IncludeCategories: - Regex: '^<.*\.h>' Priority: 1 - Regex: '^<.*' Priority: 2 - Regex: '.*' Priority: 3 IncludeIsMainRegex: '(Test)?$' IndentCaseLabels: true IndentCaseBlocks: false IndentGotoLabels: false IndentPPDirectives: After IndentWidth: 4 IndentWrappedFunctionNames: false JavaScriptQuotes: Leave JavaScriptRegex: false KeepEmptyLinesAtTheStartOfBlocks: true MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: None ObjCBlockIndentWidth: 4 ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 PenaltyBreakString: 1000 PenaltyBreakTemplateDeclaration: 500 PenaltyExcessCharacter: 1000000 PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Right ReflowComments: true SortIncludes: true SortUsingDeclarations: true SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorColon: true SpaceBeforeInheritanceColon: true SpaceBeforeKeywords: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInContainerLiterals: true SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Auto StatementMacros: - Q_ASSERT - Q_CHECK_PTR - Q_CHECK_EXCEPTION_THROWN - Q_FATAL - Q_TEST - Q_UNUSED - QT_CHECK_INIT - QVERIFY - QVERIFY2 - QCOMPARE - QCOMPARE2 - QSKIP - QFAIL - QWARN - QDEBUG - QEXPECT_FAIL - QFETCH - QFETCH_GLOBAL - QTEST - QTEST_GUI - QTEST_MOUSE - QTEST_KEYBOARD - QTEST_APP - QTEST_WIDGET - QTEST_WINDOW - QTEST_DIALOG - QTEST_MAIN - QTEST_GUI_MAIN - QTEST_MOUSE_MAIN - QTEST_KEYBOARD_MAIN - QTEST_WIDGET_MAIN - QTEST_WINDOW_MAIN - QTEST_DIALOG_MAIN - QTEST_APP_MAIN - QTEST_GUI_APP - QTEST_MOUSE_APP - QTEST_KEYBOARD_APP - QTEST_WIDGET_APP - QTEST_WINDOW_APP - QTEST_DIALOG_APP - QTEST_MAIN_APP - QTEST_GUI_MAIN_APP - QTEST_MOUSE_MAIN_APP - QTEST_KEYBOARD_MAIN_APP - QTEST_WIDGET_MAIN_APP - QTEST_WINDOW_MAIN_APP - QTEST_DIALOG_MAIN_APP TabWidth: 4 UseCRLF: false UseTab: Never WhitespaceSensitiveMacros: - STRINGIZE - MACRO_ARGS ``` 3. **保存为 `.clang-format` 文件,确保:** - **编码为 UTF-8(无 BOM)** - **换行符为 LF(Unix)** - **文件名无后缀,为 `.clang-format`** --- ## 🛠 检查和修复文件格式 ### ✅ 检查换行符: ```bash file .clang-format ``` 如果输出为: ``` .clang-format: ASCII text, with CRLF line terminators ``` 说明是 Windows 格式,需转换为 Unix 格式: ```bash dos2unix .clang-format ``` 如果没有安装 `dos2unix`,可以使用 `sed` 替换: ```bash sed -i 's/\r$//' .clang-format ``` --- ### ✅ 检查文件权限: ```bash ls -l .clang-format ``` 确保没有可执行权限: ```bash -rw-r--r-- 1 user group 3954 Apr 5 12:00 .clang-format ``` 如果有 `x` 权限,使用: ```bash chmod -x .clang-format ``` --- ## ✅ 验证 `.clang-format` 是否有效 你可以运行以下命令验证格式是否正确: ```bash clang-format -n -style=file your_source_file.c ``` 如果没有报错,并输出格式化后的内容,说明配置文件是正确的。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值