-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheading-component.vue
57 lines (56 loc) · 1.24 KB
/
heading-component.vue
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
53
54
55
56
57
<template>
<component :is="heading">
<template v-if="link!=''" >
<a :href="link" :target="link_target" v-html="final_text"></a>
</template>
<template v-else v-html="final_text">
</template>
</component>
</template>
<script>
export default{
props:{
placeholder:{
type:String,
required:false,
default:''
},
text:{
type:String,
required:true
},
size:{
type:Number,
required:false,
default:1
},
link:{
type:String,
required:false,
default:''
},
link_target:{
type:String,
required:false,
default:'_parent',
validator:function(value){
return ['_parent','_blank','_window'].indexOf(value)!=-1;
}
}
},
computed:{
heading(){
return 'h'+this.size;
},
final_text(){
if(this.placeholder!=''){
return this.placeholder.replace('{{text}}',this.text);
}else{
return this.text;
}
}
},
mounted(){
}
}
</script>