项目作者: synergixe

项目描述 :
An elegant and stylable comment box for VueJS web applications
高级语言: Vue
项目地址: git://github.com/synergixe/vue-commentbox.git
创建时间: 2018-05-18T17:57:36Z
项目社区:https://github.com/synergixe/vue-commentbox

开源协议:MIT License

下载


vue-commentbox

npm version Build Status

An elegant and stylable comment box for VueJS web applications

Getting Started

Download from NPM or Yarn

  1. npm i vue-commentbox --save
  2. yarn add vue-commentbox

Browser Support

  • IE9+
  • Opera 10.5+
  • Firefox 3.5+
  • Chrome 4.0+
  • Edge 13+

Caveats

  • This package provides a polyfill for FormData so the comment can be submitted with file attachments, you MUST also include Polyfill library to enable the code work on older browsers like IE 9/Opera 11
  • Due to some bugs related to contenteditable which have not yet been fixed, IE 9-11 and Opera 10-14 work partially

Importing

  1. import Vue from 'vue';
  2. import { CommentBox, CommentBoxPlugin } from "vue-commentbox";
  3. Vue.use(CommentBoxPlugin);

How to Use

  1. new Vue({
  2. el:"#app",
  3. template:`
  4. <main class="page">
  5. <comment-box
  6. :input-placeholder-text="placeHolderText"
  7. :comments="comments"
  8. :context-author="'Dauda Adeboye'"
  9. :context-avatar-thumb="thumbImage"
  10. :box-action="actionHref"
  11. :use-xhr="xhr"
  12. v-on:beforesend="beforeSend">
  13. />
  14. </main>`,
  15. components:{ 'comment-box':CommentBox },
  16. data:function(){
  17. return {
  18. comments:[
  19. {text: "This is a comment!"},
  20. {text: "This is another comment"}
  21. ],
  22. placeHolderText:'Post Something',
  23. xhr:true,
  24. iconFillColor:'#eeddac'
  25. }
  26. },
  27. methods:{
  28. beforeSend:function(){
  29. console.log("about to send comment to server...")
  30. }
  31. },
  32. computed:{
  33. actionHref:function(){
  34. let origin = window.location.origin;
  35. return `${origin}/store/comment`;
  36. },
  37. thumbImage:function(){
  38. let scheme = window.location.protocol;
  39. return `${scheme}//assets-cdn.store.com.ng/images/png/passport.jpg`
  40. },
  41. usernamesAvailable:function(){
  42. return true;
  43. }
  44. }
  45. });

Modify CSS

  1. .comment-body-wrapper {
  2. padding:20px; /* make the comment box smaller in size - customization */
  3. }

License

MIT

Contributing

We are pleased to have you collaborate and contribute to vue-commentbox vue package. Also, report issues with the package to synergixe.org@gmail.com Please see our CONTRIBUTION GUIDELINES here for more information

Building And Testing

  1. git clone https://github.com/synergixe/vue-commentbox.git
  2. npm install
  3. npm run lint:fix:all
  4. npm run lint
  5. npm run test
  6. npm run build