no message

Former-commit-id: 854dacd28d5d176d72cc1fbdc625917326be6daf
Former-commit-id: 889bcea85881a67a17a791d3c445cdb43fdb1a85
Former-commit-id: adb66c36629380ccf256313d10dd99a34f993e50
This commit is contained in:
李杨
2018-01-28 23:22:25 +08:00
parent 533bc4f9e7
commit 555585b332
10 changed files with 38 additions and 25 deletions

View File

@@ -30,12 +30,6 @@ export default {
padding: [40, 40, 50, 60]
}
},
created () {
// 打印信息
this.$log('G2', ...[
`version ${this.G2.version}`
])
},
mounted () {
// 如果设置了在 mounted 后自动初始化 就在这里初始化
if (this.mountedInit) {
@@ -47,6 +41,7 @@ export default {
watch: {
// 数据改变
data () {
console.log('111')
this.changeData()
}
},

View File

@@ -50,7 +50,7 @@ export default {
},
// 从 url 加载原始数据
async getReadme (name) {
const data = await this.$http.get(name)
const data = await this.$axios.get(name)
return this.marked(data)
},
marked (data) {

19
src/mock/chart/G2Line1.js Normal file
View File

@@ -0,0 +1,19 @@
import Mock from 'mockjs'
Mock.mock('/api/chart/G2Line1', () => {
return {
code: 0,
msg: '请求成功',
data: [
{ year: '1991', value: 3 },
{ year: '1992', value: 4 },
{ year: '1993', value: 3.5 },
{ year: '1994', value: 5 },
{ year: '1995', value: 4.9 },
{ year: '1996', value: 6 },
{ year: '1997', value: 7 },
{ year: '1998', value: 9 },
{ year: '1999', value: 13 }
]
}
})

View File

@@ -1,3 +1,5 @@
import '@/mock/demo/001'
import '@/mock/login'
import '@/mock/chart/G2Line1'

View File

@@ -67,7 +67,7 @@ export default {
this.$refs.loginForm.validate((valid) => {
if (valid) {
// 开始请求登录接口
this.$http({
this.$axios({
method: 'post',
url: '/login',
data: {

View File

@@ -2,7 +2,7 @@
<Container type="ghost" :responsive="true" class="demo-chart-index">
<GridLayout v-bind="layout">
<GridItem v-bind="layout.layout[0]" @resize="resizeHandler('G2Line1')" @resized="resizedHandler('G2Line1')">
<el-card><G2Line1 ref="G2Line1" :data="G2Line1Data"></G2Line1></el-card>
<el-card><G2Line1 ref="G2Line1" :data="G2Line1"></G2Line1></el-card>
</GridItem>
</GridLayout>
</Container>
@@ -29,23 +29,20 @@ export default {
margin: [10, 10],
useCssTransforms: true
},
G2Line1Data: []
// 数据
G2Line1: []
}
},
mounted () {
setTimeout(() => {
this.G2Line1Data = [
{ year: '1991', value: 3 },
{ year: '1992', value: 4 },
{ year: '1993', value: 3.5 },
{ year: '1994', value: 5 },
{ year: '1995', value: 4.9 },
{ year: '1996', value: 6 },
{ year: '1997', value: 7 },
{ year: '1998', value: 9 },
{ year: '1999', value: 13 }
const api = [
'/api/chart/G2Line1'
]
}, 3000)
this.$axios.all(api.map(e => this.$axios.get(e)))
.then(this.$axios.spread((G2Line1) => {
this.G2Line1 = G2Line1
}))
}, 300)
},
methods: {
// 改变尺寸

View File

@@ -36,7 +36,7 @@ export default {
},
methods: {
async getReadme () {
const data = await this.$http.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
const data = await this.$axios.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
return data
}
}

View File

@@ -41,7 +41,7 @@ export default {
},
methods: {
async getReadme () {
const data = await this.$http.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
const data = await this.$axios.get('/static/markdownFiles/demo/baseMarkdowmFile.md')
return data
}
}

View File

@@ -32,7 +32,7 @@ export default {
},
methods: {
ajax () {
this.$http.get('/api/demo/001')
this.$axios.get('/api/demo/001')
.then(res => {
this.table.columns = Object.keys(res.data.list[0]).map(e => ({
label: e,

View File

@@ -18,4 +18,4 @@ axios.interceptors.response.use(res => {
return Promise.reject(err)
})
Vue.prototype.$http = axios
Vue.prototype.$axios = axios