root.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import hide from './compents/hidden/hidden.vue';
  2. import vb from './asset/js/isVisibiliy.js';
  3. const myMixin ={
  4. data(){
  5. return {
  6. content:'',
  7. codeurl:'',
  8. demourl:'',
  9. levalcur:1
  10. }
  11. },
  12. components:{
  13. hide
  14. },
  15. methods:{
  16. leavelchose(index){
  17. this.levalcur = index;
  18. },
  19. closelayer(){
  20. this.content = '';
  21. },
  22. toast(e){
  23. const options = {
  24. noHeader:true,
  25. noFooter:true,
  26. content:e.target.parentElement.outerHTML
  27. }
  28. this.content = options.content;
  29. let copy = this.copy;
  30. new copy('.copy',{
  31. target:res => {
  32. return res.previousElementSibling
  33. }
  34. });
  35. },
  36. dsCode(e){
  37. let tag = e.target;
  38. if(tag.attributes.toast){
  39. this.toast(e)
  40. }
  41. }
  42. },
  43. mounted(){
  44. let visb = vb('.visibility');
  45. visb.then(res=>{
  46. let id = res.target.id;
  47. let index =Number(id.replace(/head/,''));
  48. if(index>0){
  49. this.levalcur = index
  50. }
  51. })
  52. this.$nextTick(()=>{
  53. let copy = this.copy;
  54. new copy('.copy',{
  55. target:res => {
  56. return res.previousElementSibling
  57. }
  58. });
  59. let demourl = 'https://nutui.jd.com/demo.html#'+this.$route.path;
  60. this.demourl = demourl;
  61. this.qrcode.toDataURL(demourl,{width:170},(err,url)=>{
  62. this.codeurl = url
  63. });
  64. });
  65. }
  66. }
  67. export default myMixin;