Skip to content

Commit 6698dd5

Browse files
committed
修正 dialog-link 无法使用标签内文字的问题
1 parent 60bf099 commit 6698dd5

File tree

3 files changed

+20
-10
lines changed

3 files changed

+20
-10
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
# vue-dialog
1+
# vue-dialog
2+
使用方法:
3+
1、将<dialog-view></dialog-view>加到组件App.vue
4+
2、在需要弹窗的地方,如下调用,有两种办法,
5+
一种是使用自制<dialog-link>来调用
6+
<dialog-link class="fo-btn fo-btn-secondary" to="/about" type="alert" html="<span style='color:#ff0000'>test</span>">111</dialog-link>
7+
<dialog-link class="fo-btn fo-btn-secondary" to="/about/test">222</dialog-link>
8+
第二种是:直接调用js方法:
9+
<button class="fo-btn fo-btn-secondary" v-on:click="$alert('<span>1111423423411111</span>')">333</button>

components/dialog-link.vue

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1-
<template>
2-
<a v-on:click="open" href="javascript:void(0)">{{ text }}</a>
3-
</template>
41
<script>
52
export default {
63
name: 'dialog-link',
4+
render: function(h){
5+
return h('a', {
6+
on: {
7+
click: this.open
8+
},
9+
domProps: {
10+
innerHTML: this.$slots.default[0].text
11+
}
12+
})
13+
},
714
props: ['width','height','title','model','to','html','type'],
815
data: function(){
9-
return {
10-
text: typeof(this.$slots.default) == 'undefined'?'':this.$slots.default[0].text
11-
}
16+
return {}
1217
},
1318
methods: {
1419
open: function(){

index.js

-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@ export default class VueDialog {
55
this.options = options;
66
//console.log(options);
77
}
8-
test(){
9-
console.log(test);
10-
}
118
}
129
VueDialog.install = install;

0 commit comments

Comments
 (0)