Files
mes-ui-d2/dev/snippets/vue.json

83 lines
2.4 KiB
JSON
Raw Normal View History

{
// 一个新的页面
"d2-new-page": {
"prefix": "dd-new-page",
"body": [
"<template>",
" <d2-container class=\"${1:page-name}\">",
" <!--",
" 可选 type = full(默认) | card | ghost",
" 可选 better-scroll 属性",
" 可选 better-scroll-option 属性",
" 文档 https://d2-projects.github.io/d2-admin-doc/zh/components/container.html",
" -->",
" <template slot=\"header\">header</template>",
" <span class=\"${1:page-name}_title\">this is [ {{name}} ]</span>",
" <template slot=\"footer\">footer</template>",
" </d2-container>",
"</template>",
"<script>",
"import { mapState, mapMutations } from 'vuex'",
"export default {",
" name: '${1:page-name}',",
" data () {",
" return {",
" name: '${1:page-name}'",
" }",
" },",
" computed: {",
" ...mapState({",
" // 访问用户信息",
" userInfo: state => state.d2admin.userInfo",
" })",
" },",
" methods: {",
" ...mapMutations([",
" // 操作公用数据",
" 'd2adminUtilDatabase',",
" // 操作用户私有数据",
" 'd2adminUtilDatabaseUser'",
" ])",
" }",
"}",
"</script>",
"<style lang=\"scss\" scoped>",
"@import '~@/assets/style/public.scss';",
".${1:page-name} {",
" .${1:page-name}_title {",
" font-size: 14px;",
" }",
" // Your page style here",
" // Do not use empty rulesets",
" // If the page does not need an additional definition style, please delete",
"}",
"</style>"
],
"description": "new page"
},
// d2-container 组件 header 插槽
"d2-container-header": {
"prefix": "dd-container-header",
"body": [
"<template slot=\"header\">${1:header}</template>"
],
"description": "d2-container component header slot"
},
// d2-container 组件 footer 插槽
"d2-container-footer": {
"prefix": "dd-container-footer",
"body": [
"<template slot=\"footer\">${1:footer}</template>"
],
"description": "d2-container component footer slot"
},
// 图标组件
"d2-icon": {
"prefix": "dd-icon",
"body": [
"<d2-icon name=\"${1:github}\"/>"
],
"description": "d2-icon component"
}
}