root.js 1.3 KB

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