link.js 734 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.link = void 0;
  6. var _my = require("../../__antmove/api/index.js")(my);
  7. var wx = _my;
  8. function Behavior(behavior) {
  9. behavior.$id = Number(new Date()) + String(Math.random()).substring(2, 7);
  10. return behavior;
  11. }
  12. var link = Behavior({
  13. properties: {
  14. url: String,
  15. linkType: {
  16. type: String,
  17. value: "navigateTo"
  18. }
  19. },
  20. methods: {
  21. jumpLink: function jumpLink() {
  22. var urlKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "url";
  23. var url = this.data[urlKey];
  24. if (url) {
  25. wx[this.data.linkType]({
  26. url: url
  27. });
  28. }
  29. }
  30. }
  31. });
  32. exports.link = link;