highlightCode()
let clipboard = new Clipboard('.code-copy', {
text: (trigger) => {
return trigger.previousSibling.innerText
}
})
// 复制成功执行的回调
clipboard.on('success', (e) => {
e.trigger.innerHTML = `已复制`
})
},
updated () {
highlightCode()
}
}
</script>
生成命令
在
package.json 中添加以下内容,使用命令
yarn new:comp 创建组件目录及其文档或者使用命令 yarn del:comp 即可删除组件目录及其文档
{
"scripts": {
"new:comp": "node scripts/create-comp.js && node build/build-entry.js",
"del:comp": "node scripts/delete-comp.js && node build/build-entry.js"
}
}changelog
在 package.json 中修改 script 字段,接下来你懂的,另一篇博客有介绍哦,小主可以执行搜索
{
"scripts": {
"init": "npm install commitizen -g && commitizen init cz-conventional-changelog --save-dev --save-exact && npm run bootstrap",
"bootstrap": "npm install",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
}
}总结
以上所述是小编给大家介绍的使用 Vue cli 3.0 构建自定义组件库的方法,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!










