0.0.1 • Published 2 years ago
@tqtjs/taro-plugin-platform-alipay-qn v0.0.1
taro-plugin-platform-alipay-qn
Taro 插件。用于支持编译为淘宝 PC 端小程序。
使用
1. 配置插件
// Taro 项目配置
module.exports = {
// ...
plugins: ['taro-plugin-platform-alipay-qn'],
};
2. 编译为淘宝小程序
taro build --type qn
taro build --type qn --watch
其它
平台判断
if (process.TARO_ENV === 'qn') {
// ...
}
API
淘宝小程序拓展了一些独有 API,可以通过 Taro.qn.xxx
来调用,如:
Taro.qn.navigateToWebPage({}).then((res) => console.log(res));
Typings
开发者在 global.d.ts
中加入 /// ` 即可获得类型提示。
例子:
/// <reference types="@tqtjs/taro-plugin-platform-alipay-qn/shims-qn" />
/// <reference types="@tarojs/taro" />
declare module '*.png';
declare module '*.gif';
declare module '*.jpg';
declare module '*.jpeg';
declare module '*.svg';
declare module '*.css';
declare module '*.less';
declare module '*.scss';
declare module '*.sass';
declare module '*.styl';
declare namespace NodeJS {
interface ProcessEnv {
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd' | 'qn'
}
}
0.0.1
2 years ago