root.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. var myMixin ={
  2. data(){
  3. return {
  4. content:'',
  5. codeurl:'',
  6. demourl:''
  7. }
  8. },
  9. methods:{
  10. closelayer(){
  11. this.content = '';
  12. },
  13. toast(e){
  14. const options = {
  15. noHeader:true,
  16. noFooter:true,
  17. content:e.target.parentElement.outerHTML
  18. }
  19. this.content = options.content;
  20. let copy = this.copy;
  21. new copy('.copy',{
  22. target:res => {
  23. return res.previousElementSibling
  24. }
  25. });
  26. },
  27. dsCode(e){
  28. let tag = e.target;
  29. if(tag.attributes.toast){
  30. this.toast(e)
  31. }
  32. }
  33. },
  34. mounted(){
  35. this.$nextTick(()=>{
  36. let copy = this.copy;
  37. new copy('.copy',{
  38. target:res => {
  39. return res.previousElementSibling
  40. }
  41. });
  42. let demourl = 'https://nutui.jd.com/demo.html#'+this.$route.path;
  43. this.demourl = demourl;
  44. this.qrcode.toDataURL(demourl,{width:170},(err,url)=>{
  45. this.codeurl = url
  46. });
  47. });
  48. }
  49. }
  50. module.exports = myMixin;