a.js 824 B

12345678910111213141516171819202122232425262728293031323334353637
  1. app = new Vue({
  2. el: '#app',
  3. data: {
  4. text: null,
  5. enurl: null,
  6. showtg: false,// is show the tugong ICON
  7. tgstyle: [],
  8. },
  9. watch: {
  10. showtg: function(status) {
  11. status ? this.tgstyle = ['show'] : this.tgstyle = [];
  12. if (status) {
  13. setTimeout(function() {
  14. app.showtg = false;// 显示2秒自动关闭
  15. }, 2700);
  16. }
  17. }
  18. },
  19. methods: {
  20. getTempURL: function() {
  21. axios.post('/api/get-temp', {
  22. text: app.text
  23. }).then(function(response) {
  24. var data = response.data;
  25. if (data.status == 1) {
  26. var newURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
  27. app.enurl = newURL + data.guid;
  28. } else {
  29. throw 'failure to get the tmp url!';
  30. }
  31. console.log(response);
  32. }).catch(function(error) {
  33. console.warn(error);
  34. })
  35. }
  36. }
  37. })