backBox.vue
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<template>
<div class="back-box" v-if="backs">
<div class="box">
<div class="buttons-box">
<img src="static/img/icon_back.png" class="back" @click="back" />
<div class="func-box" v-if="backs && backs.funcs && backs.funcs.funcArray">
<div class="func" v-if="backs.switch == index" v-for="(item, index) in backs.funcs.funcArray" :key="index" @click="func(backs)">
{{item.text}}
</div>
</div>
</div>
<div class="title" v-if="backs.title">{{backs.title}}</div>
</div>
</div>
</template>
<script>
export default {
data: function () {
return {
switch: false
}
},
props: ["backs"],
methods: {
/**
* 返回
*/
back() {
if (typeof this.backs.funcs === "object" && typeof this.backs.funcs.back === "function") {
this.backs.funcs.back();
}
},
/**
* 功能按钮
* @param {object} backs [props对象]
*/
func(backs) {
if (typeof this.backs.funcs === "object" && typeof this.backs.funcs.funcArray === "object" && typeof this.backs.funcs.funcArray[this.backs.switch] === "object" && typeof this.backs.funcs.funcArray[this.backs.switch].func === "function") {
this.backs.funcs.funcArray[this.backs.switch].func(backs);
}
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style rel="stylesheet/less" lang="less">
@import './backBox';
</style>