vue 文件方法声明的顺序:
-components -
props -
data -
computed -
created -
mounted -
activited -
update -
beforeRouteUpdate -
methods -
watch;
vue.js组件注释:
/*!
* Vue.js v2.6.10
* (c) 2014-2019 Evan You
* Released under the MIT License.
*/
JQ 注释:
// jQuery的文件注释
/*!
* jQuery JavaScript Library v1.11.3
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license
*
* Date: 2015-04-28T16:19Z
*/
js 的注释,常见的代码注释有:
- // 单行注释
- /** **/ 多行注释
json 文件里面的注释格式:
"_comment":"this is commets",
"jsondata":{
"注释":"注释",
"注释":"注释"
}
module 注释:
/** @module color/mixer */
/** The name of the module. */
export const name = "mixer";
/** The most recent blended color. */
export var lastColor = null;
/**
* Blend two colors together.
* @param {string} color1 - The first color, in hexadecimal format.
* @param {string} color2 - The second color, in hexadecimal format.
* @return {string} The blended color.
*/
export function blend(color1, color2) {}
// convert color to array of RGB values (0-255)
function rgbify(color) {}
export {
/**
* Get the red, green, and blue values of a color.
* @function
* @param {string} color - A color, in hexadecimal format.
* @returns {Array.<number>} An array of the red, green, and blue values,
* each ranging from 0 to 255.
*/
rgbify as toRgb,
};
常见的注释标签:
/**
* @author 作者,方便定位
* @class(同义词:@constructor)标记类和构造函数
* @constant @const常量标记
* @description(同义词:@desc) 对内容进行描述
* @module 模块名称
* @enum 枚举类型标记
* @global 全局对象标记
* @param 函数参数标记
* @returns(同义词:@return)函数返回标记
* @this this指向标记
* @see 参考链接
* @memberof 标记模块间的从属关系
* @event 在模板中标记可以被触发的事件,与@fire配合使用
* @alias 将成员视为具有不同的名称。
* @Async 表示函数是异步的。
* @augments(同义词:@extends)指示符号从父符号继承并添加到父符号。
* @borrows 此对象使用来自另一个对象的内容。
* @callback 回调函数。
* @copyright 版权信息。
* @default (同义词: @defaultvalue) 默认值。
* @example 示例。
*/