@tarojs/plugin-platform-qq
Version:
QQ 小程序平台插件
129 lines (116 loc) • 4.32 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var pluginPlatformWeapp = require('@tarojs/plugin-platform-weapp');
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
const components = {
// ======== 调整属性 ========
Button: {
'app-packagename': '',
'app-bundleid': '',
'app-connect-id': '',
'group-id': '',
'public-id': '',
'guild-id': '',
'share-type': '27',
'share-mode': '[\'qq\', \'qzone\']',
'aria-label': '',
'open-id': '',
'share-message-friend-info': '',
bindAddFriend: '',
bindAddGroupApp: ''
},
Ad: {
type: 'banner',
'ad-left': '',
'ad-top': '',
'ad-width': '',
'ad-height': '',
'block-size': '1',
'block-orientation': 'landscape',
'test-banner-type': 'three',
bindsize: '',
}
};
const PACKAGE_NAME = '@tarojs/plugin-platform-qq';
class QQ extends pluginPlatformWeapp.Weapp {
/**
* 1. setupTransaction - init
* 2. setup
* 3. setupTransaction - close
* 4. buildTransaction - init
* 5. build
* 6. buildTransaction - close
*/
constructor(ctx, config, pluginOptions) {
super(ctx, config, pluginOptions);
this.platform = 'qq';
this.globalObject = 'qq';
this.projectConfigJson = 'project.qq.json';
this.runtimePath = `${PACKAGE_NAME}/dist/runtime`;
this.fileType = {
templ: '.qml',
style: '.qss',
config: '.json',
script: '.js',
xs: '.wxs'
};
this.buildTransaction.addWrapper({
init: this.beforeBuild
});
}
beforeBuild() {
// 处理 QQ 与微信的组件差异
this.template.mergeComponents(this.ctx, components);
this.template.Adapter = {
if: 'qq:if',
else: 'qq:else',
elseif: 'qq:elif',
for: 'qq:for',
forItem: 'qq:for-item',
forIndex: 'qq:for-index',
key: 'qq:key',
xs: 'wxs',
type: 'qq'
};
}
}
var index = (ctx, options) => {
ctx.registerPlatform({
name: 'qq',
useConfigName: 'mini',
fn(_a) {
return __awaiter(this, arguments, void 0, function* ({ config }) {
const program = new QQ(ctx, config, options);
yield program.start();
});
}
});
};
exports.QQ = QQ;
exports.default = index;
//# sourceMappingURL=index.js.map