frontend-vue-development by tencentblueking/bk-ci
npx skills add https://github.com/tencentblueking/bk-ci --skill frontend-vue-development技术栈:Vue 2.7 + Vuex 3.6 + Vue Router 3.6 + bk-magic-vue 2.5
文件命名:kebab-case.vue(如 group-table.vue)
缩进:4 空格 | 无分号 | 无拖尾逗号 | HTML 双引号
API 调用:vue.$ajax.get/post/put/delete
<template>
<div class="pipeline-list">
<bk-table :data="pipelines" v-loading="isLoading">
<bk-table-column prop="name" label="名称"></bk-table-column>
</bk-table>
</div>
</template>
<script>
export default {
data() {
return {
pipelines: [],
isLoading: false
}
},
created() {
this.fetchPipelines()
},
methods: {
async fetchPipelines() {
this.isLoading = true
try {
const res = await this.$ajax.get('/api/user/pipelines')
this.pipelines = res.data || []
} finally {
this.isLoading = false
}
}
}
}
</script>
<style lang="scss" scoped>
.pipeline-list {
padding: 20px;
}
</style>
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
01-backend-microservice-development05-go-agent-developmentsrc/frontend/
├── devops-pipeline/ # 流水线应用
├── devops-atomstore/ # 研发商店应用
├── devops-manage/ # 管理应用
├── bk-pipeline/ # 流水线组件库
└── bk-permission/ # 权限组件库
{
"indent": ["error", 4], // 4 空格缩进
"semi": ["error", "never"], // 禁用分号
"comma-dangle": ["error", "never"], // 禁用拖尾逗号
"vue/html-quotes": ["error", "double"],// HTML 双引号
"vue/no-v-html": "error", // 禁止 v-html(防 XSS)
"no-console": "error" // 禁止 console
}
export default {
components: { }, // 1. 组件注册
mixins: [ ], // 2. 混入
props: { }, // 3. Props
data() { }, // 4. 响应式数据
computed: { }, // 5. 计算属性
watch: { }, // 6. 侦听器
created() { }, // 7. 生命周期钩子
mounted() { },
methods: { } // 8. 方法
}
props: {
resourceType: {
type: String,
default: ''
},
options: {
type: Array,
default: () => [] // 对象/数组使用工厂函数
}
}
// GET
this.$ajax.get(`${prefix}/user/pipelines`)
// POST
this.$ajax.post(`${prefix}/user/pipelines`, data)
// 错误处理
this.$ajax.get(url)
.then(res => this.data = res.data)
.catch(err => {
if ([404, 403].includes(err.code)) {
this.errorCode = err.code
}
})
.finally(() => this.isLoading = false)
// store/pipeline.js
export const actions = {
getPipelineList({ commit }, { projectId }) {
return vue.$ajax.get(`/api/user/projects/${projectId}/pipelines`)
}
}
// 组件中使用
import { mapActions } from 'vuex'
methods: {
...mapActions('pipeline', ['getPipelineList']),
async fetchData() {
this.list = await this.getPipelineList({ projectId: this.projectId })
}
}
| 类型 | 命名模式 | 示例 |
|---|---|---|
| 事件处理 | handle* | handleClick() |
| 初始化 | init* | initData() |
| 格式化 | *Formatter | statusFormatter() |
开发组件前确认:
每周安装量
100
代码仓库
GitHub 星标数
2.5K
首次出现
2026年1月23日
安全审计
已安装于
gemini-cli82
opencode82
codex80
cursor77
github-copilot74
claude-code66
Perl 5.36+ 现代开发模式与最佳实践 | 构建健壮可维护应用程序指南
1,200 周安装