Add vue-core-image-upload

pull/38/head
lin-xin 2017-02-20 11:15:58 +08:00
parent f96ba1afac
commit 1bdfc745ef
8 changed files with 113 additions and 41 deletions

View File

@ -27,7 +27,15 @@ module.exports = {
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
proxyTable: {
'/api':{
target:'http://jsonplaceholder.typicode.com',
changeOrigin:true,
pathRewrite:{
'^/api':''
}
}
},
// CSS Sourcemaps off by default because relative paths are "buggy"
// with this option, according to the CSS-Loader README
// (https://github.com/webpack/css-loader#sourcemaps)

View File

@ -3,9 +3,9 @@
<head>
<meta charset="utf-8">
<title>manage-system</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
</head>
<body>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

View File

@ -12,6 +12,7 @@
"axios": "^0.15.3",
"element-ui": "^1.1.6",
"vue": "^2.1.10",
"vue-core-image-upload": "^2.0.5",
"vue-datasource": "^1.0.4",
"vue-quill-editor": "^1.1.1",
"vue-router": "^2.2.0",

View File

@ -11,7 +11,7 @@
<el-menu-item index="baseform">基本表单</el-menu-item>
<el-menu-item index="vueeditor">编辑器</el-menu-item>
<el-menu-item index="markdown">markdown</el-menu-item>
<el-menu-item index="2-3">文件上传</el-menu-item>
<el-menu-item index="upload">文件上传</el-menu-item>
</el-submenu>
<el-submenu index="3">
<template slot="title"><i class="el-icon-star-on"></i>UI元素</template>

View File

@ -0,0 +1,60 @@
<template>
<div>
<div class="crumbs">
<el-breadcrumb separator="/">
<el-breadcrumb-item><i class="el-icon-date"></i> 表单</el-breadcrumb-item>
<el-breadcrumb-item>图片上传</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="plugins-tips">
Vue-Core-Image-Upload一款轻量级的vue上传插件支持裁剪
访问地址<a href="https://github.com/Vanthink-UED/vue-core-image-upload" target="_blank">Vue-Core-Image-Upload</a>
</div>
<img class="pre-img" :src="src" alt="">
<vue-core-image-upload :class="['pure-button','pure-button-primary','js-btn-crop']"
:crop="true"
text="上传图片"
url="/api/posts/"
extensions="png,gif,jpeg,jpg"
v-on:imageuploaded="imageuploaded"></vue-core-image-upload>
</div>
</template>
<script>
import VueCoreImageUpload from 'vue-core-image-upload';
export default {
data: function(){
return {
src: '../../../static/img/img.jpg',
}
},
components: {
VueCoreImageUpload
},
methods:{
imageuploaded(res) {
console.log(res)
},
}
}
</script>
<style>
.pre-img{
width:250px;
height: 250px;
margin-bottom: 20px;
}
.pure-button{
width:150px;
height:40px;
line-height: 40px;
text-align: center;
background: #00a2ff;
color: #fff;
border-radius: 3px;
}
.g-core-image-corp-container .info-aside{
height:45px;
}
</style>

View File

@ -81,7 +81,6 @@
},
beforeMount(){
axios.get('../../../static/data.json').then( (res) => {
console.log(res.data)
this.information = res.data;
})
}

View File

@ -24,6 +24,10 @@ export default new Router({
{
path: '/markdown',
component: resolve => require(['../components/page/Markdown.vue'], resolve)
},
{
path: '/upload',
component: resolve => require(['../components/page/Upload.vue'], resolve)
}
]
})

BIN
static/img/img.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB