示例代码
const highlightedColor = this.options?.infoStyle?.highlightedColor || '#FFFFFF';
const width = this.options?.width ?? 100;
1、babel.config.js
module.exports = {
presets: [
'@vue/app',
'@vue/babel-preset-jsx'
],
plugins: [
// 双问号
'@babel/plugin-proposal-nullish-coalescing-operator',
// 可选链
'@babel/plugin-proposal-optional-chaining'
]
};
package.json
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@babel/plugin-proposal-optional-chaining": "^7.20.7",
"@babel/register": "^7.0.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.2.2",
},