Refactor component registration

pull/9/head
johnniang 2019-04-19 16:27:17 +08:00
parent 95fcc2e49e
commit 94700624dd
6 changed files with 86 additions and 29 deletions

View File

@ -0,0 +1,12 @@
<template>
<div>upload</div>
</template>
<script>
export default {
name: 'Upload'
}
</script>
<style>
</style>

View File

@ -1,3 +1,5 @@
import Vue from 'vue'
// pro components
import AvatarList from '@/components/AvatarList'
import Ellipsis from '@/components/Ellipsis'
@ -9,17 +11,26 @@ import Trend from '@/components/Trend'
import MultiTab from '@/components/MultiTab'
import Result from '@/components/Result'
import ExceptionPage from '@/components/Exception'
import Upload from '@/components/Upload/Upload'
export {
const _components = {
AvatarList,
Trend,
Ellipsis,
FooterToolbar,
NumberInfo,
DescriptionList,
DescriptionList as DetailList,
Tree,
MultiTab,
Result,
ExceptionPage
ExceptionPage,
Upload
}
const components = {}
Object.keys(_components).forEach(key => {
components[key] = Vue.component(key, _components[key])
})
export default components

View File

@ -8,6 +8,7 @@ import './logger'
import './core/lazy_use'
import bootstrap from './core/bootstrap'
import '@/utils/filter' // global filter
import './components'
import animated from 'animate.css'
Vue.config.productionTip = false

View File

@ -111,7 +111,6 @@
</template>
<script>
import { Ellipsis } from '@/components'
import menuApi from '@/api/menu'
const columns = [
{
@ -138,9 +137,6 @@ const columns = [
}
]
export default {
components: {
Ellipsis
},
data() {
return {
data: [],

View File

@ -150,6 +150,7 @@
>
<a-tabs defaultActiveKey="1">
<a-tab-pane tab="本地上传" key="1">
<upload />
<a-upload-dragger
name="file"
:multiple="true"

View File

@ -7,29 +7,51 @@
:md="10"
:sm="24"
:xs="24"
:style="{ 'padding-bottom': '12px' }">
:style="{ 'padding-bottom': '12px' }"
>
<a-card :title="title">
<a-form layout="horizontal">
<a-form-item label="网站名称:">
<a-input v-model="link.name"/>
<a-input v-model="link.name" />
</a-form-item>
<a-form-item label="网站地址:" help="* 需要加上 http://">
<a-input v-model="link.url"/>
<a-form-item
label="网站地址:"
help="* 需要加上 http://"
>
<a-input v-model="link.url" />
</a-form-item>
<a-form-item label="Logo">
<a-input v-model="link.logo"/>
<a-input v-model="link.logo" />
</a-form-item>
<a-form-item label="分组:" help="* 非必填">
<a-input v-model="link.team"/>
<a-form-item
label="分组:"
help="* 非必填"
>
<a-input v-model="link.team" />
</a-form-item>
<a-form-item label="描述:">
<a-input type="textarea" :autosize="{ minRows: 5 }" v-model="link.description"/>
<a-input
type="textarea"
:autosize="{ minRows: 5 }"
v-model="link.description"
/>
</a-form-item>
<a-form-item>
<a-button type="primary" @click="handleSaveClick" v-if="formType==='create'"></a-button>
<a-button
type="primary"
@click="handleSaveClick"
v-if="formType==='create'"
>保存</a-button>
<a-button-group v-else>
<a-button type="primary" @click="handleSaveClick"></a-button>
<a-button type="dashed" @click="addLink" v-if="formType==='update'"></a-button>
<a-button
type="primary"
@click="handleSaveClick"
>更新</a-button>
<a-button
type="dashed"
@click="addLink"
v-if="formType==='update'"
>返回添加</a-button>
</a-button-group>
</a-form-item>
</a-form>
@ -41,7 +63,8 @@
:md="14"
:sm="24"
:xs="24"
:style="{ 'padding-bottom': '12px' }">
:style="{ 'padding-bottom': '12px' }"
>
<a-card title="所有友情链接">
<a-table
:columns="columns"
@ -49,13 +72,30 @@
:loading="loading"
:rowKey="link => link.id"
>
<template slot="url" slot-scope="text">
<a target="_blank" :href="text">{{ text }}</a>
<template
slot="url"
slot-scope="text"
>
<a
target="_blank"
:href="text"
>{{ text }}</a>
</template>
<ellipsis :length="15" tooltip slot="name" slot-scope="text">{{ text }}</ellipsis>
<span slot="action" slot-scope="text, record">
<a href="javascript:;" @click="editLink(record.id)"></a>
<a-divider type="vertical"/>
<ellipsis
:length="15"
tooltip
slot="name"
slot-scope="text"
>{{ text }}</ellipsis>
<span
slot="action"
slot-scope="text, record"
>
<a
href="javascript:;"
@click="editLink(record.id)"
>编辑</a>
<a-divider type="vertical" />
<a-popconfirm
:title="'你确定要删除【' + record.name + '】链接?'"
@confirm="deleteLink(record.id)"
@ -73,7 +113,6 @@
</template>
<script>
import { Ellipsis } from '@/components'
import linkApi from '@/api/link'
const columns = [
{
@ -97,9 +136,6 @@ const columns = [
}
]
export default {
components: {
Ellipsis
},
data() {
return {
title: '添加友情链接',