first commit
This commit is contained in:
1
tsVue3Decorators/dist/.pydio
vendored
Normal file
1
tsVue3Decorators/dist/.pydio
vendored
Normal file
@@ -0,0 +1 @@
|
||||
52a7ae51-44a0-4fb8-b228-ee992c3329f8
|
||||
1
tsVue3Decorators/dist/decorators/.pydio
vendored
Normal file
1
tsVue3Decorators/dist/decorators/.pydio
vendored
Normal file
@@ -0,0 +1 @@
|
||||
bbffd310-9271-4614-9543-bad796bc6bd6
|
||||
52
tsVue3Decorators/dist/decorators/Ioc.decorators.js
vendored
Normal file
52
tsVue3Decorators/dist/decorators/Ioc.decorators.js
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Inject = exports.Injectable = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
require("reflect-metadata");
|
||||
var ajax_model_1 = require("../model/ajax.model");
|
||||
//ioc容器 用于存放被依赖的类
|
||||
var classPool = [];
|
||||
// 收集依赖
|
||||
function Injectable() {
|
||||
return function (_constructor) {
|
||||
if (classPool.indexOf(_constructor) !== -1) {
|
||||
throw new Error('无需重复注册');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//注册
|
||||
classPool.push(_constructor);
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.Injectable = Injectable;
|
||||
// 注入依赖
|
||||
function Inject() {
|
||||
return function (_constructor, propertyName) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var propertyType;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
propertyType = Reflect.getMetadata('design:type', _constructor, propertyName);
|
||||
if (classPool.indexOf(propertyType) == -1) {
|
||||
throw new Error(propertyType + " \u6CA1\u6709\u88AB\u6CE8\u518C");
|
||||
return [2 /*return*/];
|
||||
}
|
||||
else {
|
||||
if (propertyName === "config") {
|
||||
ajax_model_1.ajaxModel.urlModelContainer = classPool[classPool.indexOf(propertyType)].AjaxConfig.ApiList;
|
||||
}
|
||||
if (propertyName === "axios") {
|
||||
_constructor[propertyName] = new classPool[classPool.indexOf(propertyType)]();
|
||||
ajax_model_1.ajaxModel.AjaxModelContainer = _constructor[propertyName];
|
||||
}
|
||||
else {
|
||||
_constructor[propertyName] = new classPool[classPool.indexOf(propertyType)]();
|
||||
}
|
||||
return [2 /*return*/, _constructor[propertyName]];
|
||||
}
|
||||
return [2 /*return*/];
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
exports.Inject = Inject;
|
||||
16
tsVue3Decorators/dist/decorators/directive.decorators.js
vendored
Normal file
16
tsVue3Decorators/dist/decorators/directive.decorators.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Directive = void 0;
|
||||
require("reflect-metadata");
|
||||
var directive_model_1 = require("../model/directive.model");
|
||||
/**
|
||||
* 收集存储Vue的指令
|
||||
* n: 指令名就是方法名
|
||||
* f: 调用方法后的返回值是个对象
|
||||
*/
|
||||
function Directive() {
|
||||
return function (target, propertyKey) {
|
||||
directive_model_1.directiveModel.DirectiveContainer = { n: propertyKey, f: target[propertyKey]() };
|
||||
};
|
||||
}
|
||||
exports.Directive = Directive;
|
||||
16
tsVue3Decorators/dist/decorators/global.decorators.js
vendored
Normal file
16
tsVue3Decorators/dist/decorators/global.decorators.js
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GlobalMethod = void 0;
|
||||
require("reflect-metadata");
|
||||
var global_method_model_1 = require("../model/global.method.model");
|
||||
/**
|
||||
* 收集存储Vue的指令
|
||||
* n: 指令名就是方法名
|
||||
* f: 调用方法后的返回值是个对象
|
||||
*/
|
||||
function GlobalMethod() {
|
||||
return function (target, propertyKey) {
|
||||
global_method_model_1.globalMethodModel.GlobalMethod = { n: "$" + propertyKey, f: target[propertyKey] };
|
||||
};
|
||||
}
|
||||
exports.GlobalMethod = GlobalMethod;
|
||||
14
tsVue3Decorators/dist/decorators/mixin.decorators.js
vendored
Normal file
14
tsVue3Decorators/dist/decorators/mixin.decorators.js
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Mixin = void 0;
|
||||
require("reflect-metadata");
|
||||
var mixin_model_1 = require("../model/mixin.model");
|
||||
/**
|
||||
* 收集存储mixin
|
||||
*/
|
||||
function Mixin() {
|
||||
return function (target, propertyKey) {
|
||||
mixin_model_1.mixinModel.MixinContainer = target[propertyKey]();
|
||||
};
|
||||
}
|
||||
exports.Mixin = Mixin;
|
||||
166
tsVue3Decorators/dist/decorators/request.decorators.js
vendored
Normal file
166
tsVue3Decorators/dist/decorators/request.decorators.js
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DELETE = exports.PUT = exports.POST = exports.GET = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
require("reflect-metadata");
|
||||
var ajax_model_1 = require("../model/ajax.model");
|
||||
function GET(RequestParams) {
|
||||
return function (target, propertyKey, descriptor) {
|
||||
var URL = checkUrl(propertyKey), handle = false;
|
||||
(RequestParams && RequestParams.url)
|
||||
? URL = RequestParams.url
|
||||
: (RequestParams && RequestParams.useHandle)
|
||||
? handle = RequestParams.useHandle
|
||||
: '';
|
||||
var OldMethods = descriptor.value;
|
||||
if (handle) {
|
||||
// @ts-ignore
|
||||
descriptor.value = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var result;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, ajax_model_1.ajaxModel.AjaxModelContainer.get({
|
||||
url: URL,
|
||||
data: args[0]
|
||||
})];
|
||||
case 1:
|
||||
result = _a.sent();
|
||||
return [4 /*yield*/, OldMethods.apply(new target.constructor, result)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return descriptor;
|
||||
}
|
||||
else {
|
||||
descriptor.value = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, ajax_model_1.ajaxModel.AjaxModelContainer.get({
|
||||
url: URL,
|
||||
data: args[0]
|
||||
})];
|
||||
case 1:
|
||||
_a.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
return descriptor;
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.GET = GET;
|
||||
function POST() {
|
||||
return function (target, propertyKey, descriptor) {
|
||||
var URL = checkUrl(propertyKey);
|
||||
var method = descriptor.value;
|
||||
descriptor.value = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var result;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, ajax_model_1.ajaxModel.AjaxModelContainer.post({
|
||||
url: URL,
|
||||
data: args[0]
|
||||
})];
|
||||
case 1:
|
||||
result = _a.sent();
|
||||
return [4 /*yield*/, method.apply(new target.constructor, result)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [2 /*return*/, result];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
exports.POST = POST;
|
||||
function PUT() {
|
||||
return function (target, propertyKey, descriptor) {
|
||||
var URL = checkUrl(propertyKey);
|
||||
var method = descriptor.value;
|
||||
descriptor.value = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var result;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, ajax_model_1.ajaxModel.AjaxModelContainer.put({
|
||||
url: URL,
|
||||
data: args[0]
|
||||
})];
|
||||
case 1:
|
||||
result = _a.sent();
|
||||
return [4 /*yield*/, method.apply(new target.constructor, result)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [2 /*return*/, result];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
exports.PUT = PUT;
|
||||
function DELETE() {
|
||||
return function (target, propertyKey, descriptor) {
|
||||
var URL = checkUrl(propertyKey);
|
||||
var method = descriptor.value;
|
||||
descriptor.value = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var result;
|
||||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, ajax_model_1.ajaxModel.AjaxModelContainer.delete({
|
||||
url: URL,
|
||||
data: args[0]
|
||||
})];
|
||||
case 1:
|
||||
result = _a.sent();
|
||||
return [4 /*yield*/, method.apply(new target.constructor, result)];
|
||||
case 2:
|
||||
_a.sent();
|
||||
return [2 /*return*/, result];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
exports.DELETE = DELETE;
|
||||
function checkUrl(URL) {
|
||||
if (ajax_model_1.ajaxModel.urlModelContainer[URL] == undefined) {
|
||||
throw new Error("\uD83E\uDD2A\u6CE8\u89E3\u4F20\u5165\u53C2\u6570\u7684key\u540D\u79F0\uFF1A" + URL + "\uFF0C\u5728 config.AjaxConfig.ApiList \u5BF9\u8C61\u4E0A\u4E0D\u5B58\u5728\uFF01\uFF01");
|
||||
return '';
|
||||
}
|
||||
else {
|
||||
return ajax_model_1.ajaxModel.urlModelContainer[URL];
|
||||
}
|
||||
}
|
||||
24
tsVue3Decorators/dist/decorators/startboot.decorators.js
vendored
Normal file
24
tsVue3Decorators/dist/decorators/startboot.decorators.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.StartBoot = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
function StartBoot(closeWelcome) {
|
||||
if (closeWelcome === void 0) { closeWelcome = true; }
|
||||
return function (_constructor) {
|
||||
return /** @class */ (function (_super) {
|
||||
tslib_1.__extends(class_1, _super);
|
||||
function class_1() {
|
||||
var _this = _super.call(this) || this;
|
||||
closeWelcome ? _this.WelcomeUser() : '';
|
||||
return _this;
|
||||
}
|
||||
class_1.prototype.WelcomeUser = function () {
|
||||
console.clear();
|
||||
console.info("🎉 欢迎使用脚手架模板 Vue3Template\n🎉 基于Vue-cli3+Vue3+TypeScript开发,一起感受Vue3+TypeScript的魅力吧\n📦 项目地址:https://github.com/helpcode/Vue3Template\n📦 注解包地址:https://www.npmjs.com/package/vue3decorators");
|
||||
console.log("");
|
||||
};
|
||||
return class_1;
|
||||
}(_constructor));
|
||||
};
|
||||
}
|
||||
exports.StartBoot = StartBoot;
|
||||
1
tsVue3Decorators/dist/model/.pydio
vendored
Normal file
1
tsVue3Decorators/dist/model/.pydio
vendored
Normal file
@@ -0,0 +1 @@
|
||||
67991ae4-3d3c-4efe-ae47-832c0548118d
|
||||
29
tsVue3Decorators/dist/model/ajax.model.js
vendored
Normal file
29
tsVue3Decorators/dist/model/ajax.model.js
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ajaxModel = void 0;
|
||||
var AjaxModel = /** @class */ (function () {
|
||||
function AjaxModel() {
|
||||
}
|
||||
Object.defineProperty(AjaxModel.prototype, "urlModelContainer", {
|
||||
get: function () {
|
||||
return this._urlModelContainer;
|
||||
},
|
||||
set: function (AjaxUrl) {
|
||||
this._urlModelContainer = AjaxUrl;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(AjaxModel.prototype, "AjaxModelContainer", {
|
||||
get: function () {
|
||||
return this._AjaxModelContainer;
|
||||
},
|
||||
set: function (AjaxObjecy) {
|
||||
this._AjaxModelContainer = AjaxObjecy;
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return AjaxModel;
|
||||
}());
|
||||
exports.ajaxModel = new AjaxModel();
|
||||
20
tsVue3Decorators/dist/model/directive.model.js
vendored
Normal file
20
tsVue3Decorators/dist/model/directive.model.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.directiveModel = void 0;
|
||||
var DirectiveModel = /** @class */ (function () {
|
||||
function DirectiveModel() {
|
||||
this._DirectiveContainer = [];
|
||||
}
|
||||
Object.defineProperty(DirectiveModel.prototype, "DirectiveContainer", {
|
||||
get: function () {
|
||||
return this._DirectiveContainer;
|
||||
},
|
||||
set: function (Directive) {
|
||||
this._DirectiveContainer.push(Directive);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return DirectiveModel;
|
||||
}());
|
||||
exports.directiveModel = new DirectiveModel();
|
||||
20
tsVue3Decorators/dist/model/global.method.model.js
vendored
Normal file
20
tsVue3Decorators/dist/model/global.method.model.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.globalMethodModel = void 0;
|
||||
var GlobalMethod = /** @class */ (function () {
|
||||
function GlobalMethod() {
|
||||
this._GlobalMethod = [];
|
||||
}
|
||||
Object.defineProperty(GlobalMethod.prototype, "GlobalMethod", {
|
||||
get: function () {
|
||||
return this._GlobalMethod;
|
||||
},
|
||||
set: function (globalMethod) {
|
||||
this._GlobalMethod.push(globalMethod);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return GlobalMethod;
|
||||
}());
|
||||
exports.globalMethodModel = new GlobalMethod();
|
||||
19
tsVue3Decorators/dist/model/injectable.model.js
vendored
Normal file
19
tsVue3Decorators/dist/model/injectable.model.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var InjectableModel = /** @class */ (function () {
|
||||
function InjectableModel() {
|
||||
this._InjectableModelContainer = [];
|
||||
}
|
||||
Object.defineProperty(InjectableModel.prototype, "InjectableModel", {
|
||||
get: function () {
|
||||
return this._InjectableModelContainer;
|
||||
},
|
||||
set: function (constructor) {
|
||||
this._InjectableModelContainer.push(constructor);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return InjectableModel;
|
||||
}());
|
||||
exports.InjectModel = new InjectableModel();
|
||||
20
tsVue3Decorators/dist/model/mixin.model.js
vendored
Normal file
20
tsVue3Decorators/dist/model/mixin.model.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.mixinModel = void 0;
|
||||
var MixinModel = /** @class */ (function () {
|
||||
function MixinModel() {
|
||||
this._MixinContainer = [];
|
||||
}
|
||||
Object.defineProperty(MixinModel.prototype, "MixinContainer", {
|
||||
get: function () {
|
||||
return this._MixinContainer;
|
||||
},
|
||||
set: function (Mixin) {
|
||||
this._MixinContainer.push(Mixin);
|
||||
},
|
||||
enumerable: false,
|
||||
configurable: true
|
||||
});
|
||||
return MixinModel;
|
||||
}());
|
||||
exports.mixinModel = new MixinModel();
|
||||
19
tsVue3Decorators/dist/model/startboot.model.js
vendored
Normal file
19
tsVue3Decorators/dist/model/startboot.model.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var StartbootModel = /** @class */ (function () {
|
||||
function StartbootModel() {
|
||||
this._StartbootModelContainer = [];
|
||||
}
|
||||
Object.defineProperty(StartbootModel.prototype, "StartbootModelContainer", {
|
||||
get: function () {
|
||||
return this._StartbootModelContainer;
|
||||
},
|
||||
set: function (constructor) {
|
||||
this._StartbootModelContainer.push(constructor);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
return StartbootModel;
|
||||
}());
|
||||
exports.ajaxModel = new StartbootModel();
|
||||
Reference in New Issue
Block a user