加载中...

@example


描述: 提供一个如何使用描述项的例子。

Overview(概述)

提供一个如何使用描述项的例子。跟随此标签的文字将显示为高亮代码。

Examples(例子)

注意,一个doclet中可以同时使用多个@example标签。

例如,描述多个示例:

  1. /**
  2. * Solves equations of the form a * x = b
  3. * @example
  4. * // returns 2
  5. * globalNS.method1(5, 10);
  6. * @example
  7. * // returns 3
  8. * globalNS.method(5, 15);
  9. * @returns {Number} Returns the value of x for the equation.
  10. */
  11. globalNS.method1 = function (a, b) {
  12. return b / a;
  13. };

@example标签后面可以添加 标签作为示例的标题。

例如,带有标题的例子:

  1. /**
  2. * Solves equations of the form a * x = b
  3. * @example <caption>Example usage of method1.</caption>
  4. * // returns 2
  5. * globalNS.method1(5, 10);
  6. * @returns {Number} Returns the value of x for the equation.
  7. */
  8. globalNS.method1 = function (a, b) {
  9. return b / a;
  10. };

还没有评论.