新增 lay-comment 组件
This commit is contained in:
31
example/src/components/LayComment.vue
Normal file
31
example/src/components/LayComment.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<div id="comment"></div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: 'Utterances',
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
default: 6
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initValine () {
|
||||
const utterances = document.createElement('script');
|
||||
utterances.type = 'text/javascript';
|
||||
utterances.async = true;
|
||||
utterances.setAttribute('issue-number', this.id)
|
||||
utterances.setAttribute('theme','github-light')
|
||||
utterances.setAttribute('repo',`layui-vue/layui-vue`)
|
||||
utterances.crossorigin = 'anonymous';
|
||||
utterances.src = 'https://utteranc.es/client.js';
|
||||
window.document.getElementById('comment').appendChild(utterances);
|
||||
|
||||
}
|
||||
},
|
||||
mounted: function(){
|
||||
this.initValine()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user