init
No files matched your search
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Eslint config file
|
||||||
|
* Documentation: https://eslint.org/docs/user-guide/configuring/
|
||||||
|
* Install the Eslint extension before using this feature.
|
||||||
|
*/
|
||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
es6: true,
|
||||||
|
browser: true,
|
||||||
|
node: true,
|
||||||
|
},
|
||||||
|
ecmaFeatures: {
|
||||||
|
modules: true,
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2018,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
wx: true,
|
||||||
|
App: true,
|
||||||
|
Page: true,
|
||||||
|
getCurrentPages: true,
|
||||||
|
getApp: true,
|
||||||
|
Component: true,
|
||||||
|
requirePlugin: true,
|
||||||
|
requireMiniProgram: true,
|
||||||
|
},
|
||||||
|
// extends: 'eslint:recommended',
|
||||||
|
rules: {},
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"pages": [
|
||||||
|
"pages/index/index",
|
||||||
|
"pages/logs/logs"
|
||||||
|
],
|
||||||
|
"window": {
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
},
|
||||||
|
"style": "v2",
|
||||||
|
"sitemapLocation": "sitemap.json"
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
/**app.wxss**/
|
||||||
|
// .container {
|
||||||
|
// height: 100%;
|
||||||
|
// display: flex;
|
||||||
|
// flex-direction: column;
|
||||||
|
// align-items: center;
|
||||||
|
// justify-content: space-between;
|
||||||
|
// padding: 200rpx 0;
|
||||||
|
// box-sizing: border-box;
|
||||||
|
// }
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// app.ts
|
||||||
|
App<IAppOption>({
|
||||||
|
globalData: {},
|
||||||
|
onLaunch() {
|
||||||
|
// 展示本地存储能力
|
||||||
|
const logs = wx.getStorageSync('logs') || []
|
||||||
|
logs.unshift(Date.now())
|
||||||
|
wx.setStorageSync('logs', logs)
|
||||||
|
|
||||||
|
// 登录
|
||||||
|
wx.login({
|
||||||
|
success: res => {
|
||||||
|
console.log(res.code)
|
||||||
|
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
// wx.loadFontFace({
|
||||||
|
// family: 'Ali Puhui',
|
||||||
|
// source:
|
||||||
|
// 'url("https://puhuiti.oss-cn-hangzhou.aliyuncs.com/AlibabaPuHuiTi-2/AlibabaPuHuiTi-2-75-SemiBold/AlibabaPuHuiTi-2-75-SemiBold.ttf")',
|
||||||
|
// success: ()=>{console.log('success')}
|
||||||
|
// })
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
/**index.wxss**/
|
||||||
|
|
||||||
|
.container{
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width:100%;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: rgba($color: #fff5d2, $alpha: 1.0);
|
||||||
|
// font-family: "Ali Puhui";
|
||||||
|
// font-family:Arial, Helvetica, sans-serif
|
||||||
|
}
|
||||||
|
#startPage{
|
||||||
|
display: flex;
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width:100%;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: rgba($color: #fff5d2, $alpha: 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.text_startPage{
|
||||||
|
font-size: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.buttom_startPage{
|
||||||
|
background-color: rgba($color: #d2fff4, $alpha: 1);
|
||||||
|
border-radius: 20rpx;
|
||||||
|
box-shadow: rgba(0, 0, 0, 0.19) 0px 10px 20px, rgba(0, 0, 0, 0.23) 0px 6px 6px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
#gotoSearch{
|
||||||
|
height: 200rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 300rpx;
|
||||||
|
width: 80%;
|
||||||
|
.text_startPage{
|
||||||
|
font-size: 80rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#buttom_startPage1{
|
||||||
|
height: 130rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 550rpx;
|
||||||
|
width: 50%;
|
||||||
|
left: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#buttom_startPage2{
|
||||||
|
height: 130rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 550rpx;
|
||||||
|
width: 20%;
|
||||||
|
right: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#buttom_startPage4{
|
||||||
|
height: 130rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 720rpx;
|
||||||
|
width: 50%;
|
||||||
|
right: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#buttom_startPage3{
|
||||||
|
height: 130rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 720rpx;
|
||||||
|
width: 20%;
|
||||||
|
left: 10%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#tips_startPage{
|
||||||
|
height: 80rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 1000rpx;
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.test{
|
||||||
|
height: 100rpx;
|
||||||
|
width: 100rpx;
|
||||||
|
position: relative;
|
||||||
|
top:1200rpx;
|
||||||
|
margin: 50rpx;
|
||||||
|
// left:-200rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.miao_page{
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 相机界面 丑是丑了点,后面再优化吧
|
||||||
|
#page_camera{
|
||||||
|
background-color: black;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
translate:0 100%;
|
||||||
|
#camera{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top:0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
#buttom_takePhoto{
|
||||||
|
height: 150rpx;
|
||||||
|
width: 150rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba($color: #15aa87, $alpha: 1);
|
||||||
|
position: absolute;
|
||||||
|
bottom: 120rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
#buttom_takePhoto1{
|
||||||
|
height: 120rpx;
|
||||||
|
width: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgb(240, 255, 247);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#page_camera_background{
|
||||||
|
height: 400rpx;
|
||||||
|
width: 100%;
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
// background-color: white;
|
||||||
|
// background-color: black;
|
||||||
|
bottom: 0rpx;
|
||||||
|
left:0rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
#page_camera_back{
|
||||||
|
height: 110rpx;
|
||||||
|
width: 110rpx;
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
// background-color: aquamarine;
|
||||||
|
bottom: 140rpx;
|
||||||
|
left:80rpx;
|
||||||
|
// font-size: 150rpx;
|
||||||
|
// font-weight: 900;
|
||||||
|
// font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
|
||||||
|
}
|
||||||
|
#page_camera_local{
|
||||||
|
height: 110rpx;
|
||||||
|
width: 110rpx;
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
// background-color: aquamarine;
|
||||||
|
bottom: 140rpx;
|
||||||
|
right:80rpx;
|
||||||
|
// font-size: 150rpx;
|
||||||
|
// font-weight: 900;
|
||||||
|
// font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,166 @@
|
|||||||
|
// index.ts
|
||||||
|
// 获取应用实例
|
||||||
|
|
||||||
|
const app = getApp<IAppOption>()
|
||||||
|
|
||||||
|
Page({
|
||||||
|
ctx:wx.createCameraContext(),
|
||||||
|
data: {
|
||||||
|
motto: 'Hello World',
|
||||||
|
text_startPage1: "知识库",
|
||||||
|
text_startPage4: "个性化",
|
||||||
|
imgUrl_startPage1:"./static/icons/lib.svg",
|
||||||
|
imgUrl_startPage2:"./static/icons/history.svg",
|
||||||
|
imgUrl_startPage3:"./static/icons/heart.svg",
|
||||||
|
imgUrl_startPage4:"./static/icons/self.svg",
|
||||||
|
tip_content: "不吃饭会饿死",
|
||||||
|
tip_hidden: false,
|
||||||
|
active_Page: "startPage",
|
||||||
|
// userInfo: {},
|
||||||
|
// hasUserInfo: false,
|
||||||
|
// canIUse: wx.canIUse('button.open-type.getUserInfo'),
|
||||||
|
// canIUseGetUserProfile: false,
|
||||||
|
// canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
// @ts-ignore
|
||||||
|
if (wx.getUserProfile) {
|
||||||
|
this.setData({
|
||||||
|
canIUseGetUserProfile: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
startPage_Bottons_leave() {
|
||||||
|
// var fd = wx.createSelectorQuery()
|
||||||
|
var time = 700;
|
||||||
|
var time1 = () => {
|
||||||
|
return Math.random() * 200;
|
||||||
|
}
|
||||||
|
this.animate('#gotoSearch', [
|
||||||
|
{ opacity: 1, translateY: 0, ease: 'ease-in' }, { opacity: 0, translateY: -300, ease: 'ease-in' },
|
||||||
|
], time)
|
||||||
|
this.animate('#tips_startPage', [
|
||||||
|
{ opacity: 1, ease: 'ease-in' }, { opacity: 0, ease: 'ease-in' },
|
||||||
|
], time, () => {
|
||||||
|
// this.setData({ tip_hidden: true })
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage1', [
|
||||||
|
{ opacity: 1, translateX: 0, ease: 'ease-in' }, { opacity: 0, translateX: -300, ease: 'ease-in' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage3', [
|
||||||
|
{ opacity: 1, translateX: 0, ease: 'ease-in' }, { opacity: 0, translateX: -300, ease: 'ease-in' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage4', [
|
||||||
|
{ opacity: 1, translateX: 0, ease: 'ease-in' }, { opacity: 0, translateX: 300, ease: 'ease-in' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage2', [
|
||||||
|
{ opacity: 1, translateX: 0, ease: 'ease-in' }, { opacity: 0, translateX: 300, ease: 'ease-in' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
},
|
||||||
|
startPage_Bottons_in() {
|
||||||
|
// var fd = wx.createSelectorQuery()
|
||||||
|
var time = 700;
|
||||||
|
var time1 = () => {
|
||||||
|
return Math.random() * 200;
|
||||||
|
}
|
||||||
|
this.animate('#gotoSearch', [
|
||||||
|
{ opacity: 0, translateY: -300, ease: 'ease-in' },{ opacity: 1, translateY: 0, ease: 'ease-out' },
|
||||||
|
], time)
|
||||||
|
// this.setData({ tip_hidden: false })
|
||||||
|
this.animate('#tips_startPage', [
|
||||||
|
{ opacity: 0, ease: 'ease-in' }, { opacity: 1, ease: 'ease-out' },
|
||||||
|
], time)
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage1', [
|
||||||
|
{ opacity: 0, translateX: -300, ease: 'ease-in' },{ opacity: 1, translateX: 0, ease: 'ease-out' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage3', [
|
||||||
|
{ opacity: 0, translateX: -300, ease: 'ease-in' },{ opacity: 1, translateX: 0, ease: 'ease-out' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage4', [
|
||||||
|
{ opacity: 0, translateX: 300, ease: 'ease-in' },{ opacity: 1, translateX: 0, ease: 'ease-out' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
setTimeout(() => {
|
||||||
|
this.animate('#buttom_startPage2', [
|
||||||
|
{ opacity: 0, translateX: 300, ease: 'ease-in' },{ opacity: 1, translateX: 0, ease: 'ease-out' },
|
||||||
|
], time)
|
||||||
|
}, time1())
|
||||||
|
},
|
||||||
|
|
||||||
|
popup_camera(){
|
||||||
|
this.startPage_Bottons_leave()
|
||||||
|
this.animate('#page_camera', [
|
||||||
|
{ opacity: 0, translateY: 0 }, { opacity: 1, translateY: "-100%", ease: 'ease-in-out', },
|
||||||
|
], 1000,()=>{
|
||||||
|
this.selectComponent('#page_camera')
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
exit_camera(){
|
||||||
|
this.startPage_Bottons_in()
|
||||||
|
this.animate('#page_camera', [
|
||||||
|
{ opacity: 1, translateY: "-100%" }, { opacity: 0, translateY: "0", ease: 'ease-in-out' },
|
||||||
|
], 1000)
|
||||||
|
},
|
||||||
|
|
||||||
|
takePhoto() {
|
||||||
|
// ctx = wx.createCameraContext()
|
||||||
|
console.log('takePhoto..')
|
||||||
|
this.ctx.takePhoto({
|
||||||
|
quality: 'high',
|
||||||
|
success: res => {
|
||||||
|
this.setData({
|
||||||
|
src: res.tempImagePath
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 事件处理函数
|
||||||
|
bindViewTap() {
|
||||||
|
wx.navigateTo({
|
||||||
|
url: '../logs/logs',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getUserProfile() {
|
||||||
|
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
|
||||||
|
wx.getUserProfile({
|
||||||
|
desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
|
||||||
|
success: (res) => {
|
||||||
|
console.log(res)
|
||||||
|
this.setData({
|
||||||
|
userInfo: res.userInfo,
|
||||||
|
hasUserInfo: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getUserInfo(e: any) {
|
||||||
|
// 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
|
||||||
|
console.log(e)
|
||||||
|
this.setData({
|
||||||
|
userInfo: e.detail.userInfo,
|
||||||
|
hasUserInfo: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
<!--index.wxml-->
|
||||||
|
<view class="container">
|
||||||
|
|
||||||
|
<!-- 开始界面 -->
|
||||||
|
<view class="miao_page" id = 'startPage'>
|
||||||
|
<view class="buttom_startPage" id="gotoSearch" bind:tap="popup_camera">
|
||||||
|
<!-- 最大的固定是搜索 -->
|
||||||
|
<image src="./static/icons/camera.svg" mode="'aspectFit'" style="height: 180rpx;width: 180rpx;margin-right:50rpx;" />
|
||||||
|
<view class="text_startPage">立即搜索</view>
|
||||||
|
<!-- <view class="text_startPage1">拍照搜索</view> -->
|
||||||
|
</view>
|
||||||
|
<view class='buttom_startPage' id="buttom_startPage1">
|
||||||
|
<image src="{{imgUrl_startPage1}}" mode="'aspectFit'" style="height: 100rpx;width: 100rpx;margin-right:30rpx;" />
|
||||||
|
<view class="text_startPage">{{text_startPage1}}</view>
|
||||||
|
</view>
|
||||||
|
<view class='buttom_startPage' id="buttom_startPage2">
|
||||||
|
<image src="{{imgUrl_startPage2}}" mode="'aspectFit'" style="height: 100rpx;width: 100rpx;" />
|
||||||
|
</view>
|
||||||
|
<view class='buttom_startPage' id="buttom_startPage3">
|
||||||
|
<image src="{{imgUrl_startPage3}}" mode="'aspectFit'" style="height: 100rpx;width: 100rpx;" />
|
||||||
|
</view>
|
||||||
|
<view class='buttom_startPage' id="buttom_startPage4">
|
||||||
|
<view class="text_startPage">{{text_startPage4}}</view>
|
||||||
|
<image src="{{imgUrl_startPage4}}" mode="'aspectFit'" style="height: 100rpx;width: 100rpx;margin-left:30rpx;" />
|
||||||
|
</view>
|
||||||
|
<view class="buttom_startPage" id="tips_startPage" hidden="{{tip_hidden}}" style="justify-content: left;">
|
||||||
|
<view class="tip_head" style="margin-left: 15rpx;font-weight: 600;">Daliy Tips:</view>
|
||||||
|
<view class="tip_content">{{tip_content}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="buttom_startPage test" id='test' bind:tap="startPage_Bottons_leave">测试移去</view>
|
||||||
|
<view class="buttom_startPage test" id='test2' bind:tap="popup_camera">弹出相机</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 相机界面 -->
|
||||||
|
<view id='page_camera' class="miao_page">
|
||||||
|
<camera id='camera' device-position="back" flash="off"></camera>
|
||||||
|
<view id="page_camera_background"></view>
|
||||||
|
<view id="buttom_takePhoto" bind:tap="takePhoto">
|
||||||
|
<view id="buttom_takePhoto1">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view id="page_camera_back" bind:tap="exit_camera">
|
||||||
|
<image src="./static/icons/back.svg" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
<view id="page_camera_local">
|
||||||
|
<image src="./static/icons/local_Img.svg" mode="aspectFit" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697982640031" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1466" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M670.608974 895.066254c-7.776956 0-15.656241-2.865194-21.795943-8.697911L298.645348 555.745378c-6.344359-6.037374-9.925852-14.325972-9.925852-23.023883 0-8.697911 3.581493-17.088838 9.925852-23.023883l350.167683-330.725292c12.688718-12.074748 32.847407-11.460777 44.819826 1.330269 12.074748 12.688718 11.460777 32.847407-1.330269 44.819826L366.693714 532.619167l325.711202 307.599081c12.688718 12.074748 13.302688 32.131108 1.330269 44.819826C687.493155 891.791746 678.9999 895.066254 670.608974 895.066254z" p-id="1467" fill="#15aa87"></path></svg>
|
||||||
|
After Width: | Height: | Size: 883 B |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697812002437" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="50178" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M273.066667 102.4h494.933333c94.2592 0 170.666667 76.407467 170.666667 170.666667v494.933333c0 94.2592-76.407467 170.666667-170.666667 170.666667H273.066667c-94.2592 0-170.666667-76.407467-170.666667-170.666667V273.066667c0-94.2592 76.407467-170.666667 170.666667-170.666667z m0 68.266667a102.4 102.4 0 0 0-102.4 102.4v494.933333a102.4 102.4 0 0 0 102.4 102.4h494.933333a102.4 102.4 0 0 0 102.4-102.4V273.066667a102.4 102.4 0 0 0-102.4-102.4H273.066667z" fill="#000000" p-id="50179"></path><path d="M517.973333 699.733333c94.2592 0 170.666667-76.407467 170.666667-170.666666s-76.407467-170.666667-170.666667-170.666667-170.666667 76.407467-170.666666 170.666667 76.407467 170.666667 170.666666 170.666666z m0-68.266666a102.4 102.4 0 1 1 0-204.8 102.4 102.4 0 0 1 0 204.8z" fill="#000000" p-id="50180"></path><path d="M750.933333 335.121067a34.133333 34.133333 0 1 0 0-68.266667 34.133333 34.133333 0 0 0 0 68.266667z" fill="#000000" p-id="50181"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697812442065" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="57278" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M702.131071 124.121212c-93.893818 0-161.150707 84.605414-190.140768 129.353697C482.974384 208.726626 415.747232 124.121212 321.858586 124.121212 187.126303 124.121212 77.550545 245.53503 77.550545 394.757172c0 69.772929 47.327677 169.808162 104.782869 222.157576 79.475071 102.110384 302.898424 285.923556 330.484364 285.923556 28.070788 0 246.702545-180.236929 327.611475-284.696566 58.46497-53.272566 106.020202-153.439677 106.020202-223.384566C946.449455 245.53503 836.858182 124.121212 702.131071 124.121212M888.84299 394.757172c0 55.802828-40.468687 139.081697-88.362667 181.838869-1.313616 1.197253-2.505697 2.504404-3.697778 3.944727C725.586101 673.303273 582.242909 788.363636 512.970343 838.758141 461.474263 801.065374 306.369293 683.62602 226.742949 580.176162c-1.071838-1.408-2.323394-2.721616-3.63701-3.943434-47.706505-42.702869-87.964444-125.763232-87.964444-181.475556 0-117.474263 83.752081-213.060525 186.717091-213.060525 66.368646 0 130.267798 71.83903 164.141253 143.066505 4.490343 9.438384 14.449778 15.317333 25.995636 15.317333 11.544566 0 21.500121-5.878949 26.020202-15.317333 33.842424-71.227475 97.711838-143.066505 164.115394-143.066505C805.090909 181.696646 888.84299 277.282909 888.84299 394.757172" fill="#272636" p-id="57279"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697812141935" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="52846" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M411.733333 885.333333H192c-6.4 0-10.666667-4.266667-10.666667-10.666666V149.333333c0-6.4 4.266667-10.666667 10.666667-10.666666h576c6.4 0 10.666667 4.266667 10.666667 10.666666v219.733334c0 17.066667 14.933333 32 32 32s32-14.933333 32-32V149.333333c0-40.533333-34.133333-74.666667-74.666667-74.666666H192C151.466667 74.666667 117.333333 108.8 117.333333 149.333333v725.333334c0 40.533333 34.133333 74.666667 74.666667 74.666666h219.733333c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32z" fill="#2c2c2c" p-id="52847"></path><path d="M704 458.666667c-134.4 0-245.333333 110.933333-245.333333 245.333333S569.6 949.333333 704 949.333333 949.333333 838.4 949.333333 704 838.4 458.666667 704 458.666667z m0 426.666666c-100.266667 0-181.333333-81.066667-181.333333-181.333333s81.066667-181.333333 181.333333-181.333333 181.333333 81.066667 181.333333 181.333333-81.066667 181.333333-181.333333 181.333333z" fill="#2c2c2c" p-id="52848"></path><path d="M802.133333 716.8l-66.133333-29.866667V597.333333c0-17.066667-14.933333-32-32-32s-32 14.933333-32 32v110.933334c0 12.8 8.533333 23.466667 19.2 29.866666l85.333333 38.4c4.266667 2.133333 8.533333 2.133333 12.8 2.133334 12.8 0 23.466667-6.4 29.866667-19.2 6.4-17.066667 0-34.133333-17.066667-42.666667zM693.333333 298.666667c0-17.066667-14.933333-32-32-32H298.666667c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h362.666666c17.066667 0 32-14.933333 32-32zM298.666667 437.333333c-17.066667 0-32 14.933333-32 32s14.933333 32 32 32h106.666666c17.066667 0 32-14.933333 32-32s-14.933333-32-32-32h-106.666666z" fill="#2c2c2c" p-id="52849"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697811750837" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="38161" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M454.5083 1023.996806H340.163697a57.4917 57.4917 0 0 1-57.4917-57.4917V59.413839a57.4917 57.4917 0 0 1 57.4917-57.4917H454.5083a57.4917 57.4917 0 0 1 57.4917 57.4917v907.091267a57.4917 57.4917 0 0 1-57.4917 57.4917z m-107.956637-63.879667H448.120333V65.801806H346.551663zM198.350837 1023.996806H84.006233a57.4917 57.4917 0 0 1-57.4917-57.4917V59.413839a57.4917 57.4917 0 0 1 57.4917-57.4917h114.344604A57.4917 57.4917 0 0 1 256.481333 59.413839v907.091267a57.4917 57.4917 0 0 1-58.130496 57.4917zM90.3942 960.117139H192.601667V65.801806H90.3942z" p-id="38162"></path><path d="M223.902703 234.444126H58.454367a31.939833 31.939833 0 0 1 0-63.879667h165.448336a31.939833 31.939833 0 0 1 0 63.879667zM480.060167 234.444126H314.61183a31.939833 31.939833 0 0 1 0-63.879667H480.060167a31.939833 31.939833 0 0 1 0 63.879667zM831.398333 1023.996806a56.852903 56.852903 0 0 1-55.57531-42.799377L538.82946 104.768403A58.130497 58.130497 0 0 1 579.712447 33.861973l110.511823-31.939834a57.4917 57.4917 0 0 1 70.267633 40.882987l235.077174 875.79023a58.130497 58.130497 0 0 1-40.882987 70.90643L844.174267 1023.996806zM602.07033 93.908859L831.398333 960.117139l98.374687-26.190663L703.639 65.801806z m96.458297-58.769293z" p-id="38163"></path><path d="M767.518667 866.214029a31.939833 31.939833 0 0 1-30.66224-23.635476 31.301037 31.301037 0 0 1 22.357883-38.966597l160.337963-42.799377a31.301037 31.301037 0 0 1 38.966597 22.357884 31.939833 31.939833 0 0 1-22.99668 38.966596l-159.699167 42.799377a19.1639 19.1639 0 0 1-8.304356 1.277593z" p-id="38164"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697982696150" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2618" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M603.675 177.371c-6.044-1.613-12.131 1.924-13.744 7.834-1.612 5.954 1.88 12.131 7.834 13.788 94.817 26.099 174.32 95.89 212.685 186.674 1.792 4.297 5.91 6.85 10.297 6.85 1.432 0 2.91-0.269 4.387-0.896 5.685-2.373 8.326-8.952 5.909-14.637-41.005-97.054-125.971-171.679-227.368-199.613zM425.927 308.012c-37.066 0-67.15 30.083-67.15 67.149 0 37.065 30.083 67.149 67.15 67.149 37.065 0 67.149-30.083 67.149-67.149s-30.082-67.149-67.149-67.149z" p-id="2619" fill="#15aa87"></path><path d="M511.319 64.223c-247.245 0-447.663 200.419-447.663 447.663 0 247.243 200.419 447.662 447.663 447.662 247.243 0 447.663-200.419 447.663-447.662 0-247.244-200.42-447.663-447.663-447.663zM159.838 708.414c44.101-36.608 99.252-56.647 157.046-56.647 55.957 0 109.485 18.837 152.884 53.29-44.238 52.563-75.398 116.786-88.138 187.925-94.588-32.295-173.484-98.734-221.792-184.568z m351.481 206.368c-29.681 0-58.51-3.447-86.355-9.58 28.516-171.455 177.141-298.905 352.848-298.905 41.141 0 81.161 7.252 119.392 20.816-49.691 166.174-203.776 287.669-385.885 287.669z m266.493-353.251c-106.82 0-204.693 41.943-277.22 110.888C448.78 630.139 384.325 607 316.885 607c-64.715 0-126.598 21.241-177.229 60.238-20.108-47.808-31.236-100.29-31.236-155.352 0-222.177 180.722-402.898 402.896-402.898S914.212 289.71 914.212 511.886c0 24.397-2.553 48.168-6.716 71.402-41.629-14.19-85.052-21.757-129.684-21.757z" p-id="2620" fill="#15aa87"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697812304038" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="55172" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M957.8 625.2c-5-15.4-17.4-27.4-33-32l-116.6-34.4-68.8-100.2c-9.2-13.4-24.4-21.4-40.6-21.4-16.2 0-31.4 8-40.6 21.4l-68.8 100.2-116.6 34.4c-15.6 4.6-27.8 16.6-33 32-5 15.4-2.2 32.4 7.8 45.2l74.2 96.4-3.4 121.6c-0.4 16.2 7.2 31.6 20.2 41.2 8.6 6.2 18.6 9.4 29 9.4 5.6 0 11.2-1 16.6-2.8l114.6-40.8 114.6 40.8c15.4 5.4 32.4 3 45.4-6.6 13.2-9.6 20.8-25 20.2-41.2l-3.4-121.6 74.2-96.4c10-12.8 13-29.8 8-45.2z m-131.8 108c-6.8 9-10.6 20.2-10.2 31.4l3 109.6-103.4-36.8c-10.6-3.8-22.4-3.8-33 0l-103.4 36.8 3-109.6c0.4-11.2-3.4-22.4-10.2-31.4l-66.8-87 105.2-31c10.8-3.2 20.4-10 26.8-19.4l62-90.4 62 90.4c6.4 9.4 15.8 16.2 26.8 19.4l105.2 31-67 87z" p-id="55173"></path><path d="M641 660c-16.6 0-30 13.4-30 30v27.4c0 16.6 13.4 30 30 30s30-13.4 30-30V690c0-16.6-13.6-30-30-30zM756.6 660c-16.6 0-30 13.4-30 30v27.4c0 16.6 13.4 30 30 30s30-13.4 30-30V690c0-16.6-13.4-30-30-30zM406.4 737.2H179.6c-30.8 0-55.8-25-55.8-55.8V200.8c0-30.8 25-55.8 55.8-55.8h543.4c30.8 0 55.8 25 55.8 55.8v230.2c0 16.6 13.4 30 30 30s30-13.4 30-30V200.8c0-63.8-52-115.8-115.8-115.8H179.6c-63.8 0-115.8 52-115.8 115.8v480.4c0 63.8 52 115.8 115.8 115.8h226.8c16.6 0 30-13.4 30-30s-13.4-29.8-30-29.8z" p-id="55174"></path><path d="M629 343.2h58.2c16.6 0 30-13.4 30-30s-13.4-30-30-30h-58.2c-12.8-41.6-51.6-72-97.4-72-45.8 0-84.6 30.4-97.4 72H218.8c-16.6 0-30 13.4-30 30s13.4 30 30 30H434c12.8 41.6 51.6 72 97.4 72 45.8 0 84.6-30.2 97.6-72z m-139.6-30c0-23.2 18.8-42 42-42s42 18.8 42 42-18.8 42-42 42-42-18.8-42-42zM388.2 503.2c-12.8-41.6-51.6-72-97.4-72-56.2 0-102 45.8-102 102s45.8 102 102 102c45.8 0 84.6-30.4 97.4-72h63c16.6 0 30-13.4 30-30s-13.4-30-30-30h-63z m-97.4 72c-23.2 0-42-18.8-42-42s18.8-42 42-42 42 18.8 42 42-18.8 42-42 42z" p-id="55175"></path></svg>
|
||||||
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1697812184181" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="53868" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 85.333333a42.666667 42.666667 0 0 1 35.114667 18.432l107.605333 155.946667A42.666667 42.666667 0 0 1 584.533333 308.181333L512 203.093333 404.736 358.570667a42.666667 42.666667 0 0 1-23.125333 16.725333L200.064 428.373333l115.285333 148.736a42.666667 42.666667 0 0 1 8.917334 27.306667l-5.205334 187.946667 178.730667-63.146667a42.666667 42.666667 0 0 1 28.416 0l178.773333 63.146667-5.248-187.946667a42.666667 42.666667 0 0 1 8.96-27.306667l115.2-148.736-93.44-27.392a42.666667 42.666667 0 1 1 23.936-81.92l153.6 45.013334a42.666667 42.666667 0 0 1 21.76 67.072L785.493333 617.386667l6.485334 234.752a42.666667 42.666667 0 0 1-56.874667 41.386666L512 814.805333l-223.146667 78.805334a42.666667 42.666667 0 0 1-56.832-41.386667l6.485334-234.794667-144.213334-186.197333a42.666667 42.666667 0 0 1 21.76-67.072L343.04 297.642667l133.802667-193.877334A42.666667 42.666667 0 0 1 512 85.333333z" fill="#2c2c2c" p-id="53869"></path></svg>
|
||||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "查看启动日志",
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// logs.ts
|
||||||
|
// const util = require('../../utils/util.js')
|
||||||
|
import { formatTime } from '../../utils/util'
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
logs: [],
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.setData({
|
||||||
|
logs: (wx.getStorageSync('logs') || []).map((log: string) => {
|
||||||
|
return {
|
||||||
|
date: formatTime(new Date(log)),
|
||||||
|
timeStamp: log
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<!--logs.wxml-->
|
||||||
|
<!-- <view class="container log-list">
|
||||||
|
<block wx:for="{{logs}}" wx:key="timeStamp" wx:for-item="log">
|
||||||
|
<text class="log-item">{{index + 1}}. {{log.date}}</text>
|
||||||
|
</block>
|
||||||
|
</view> -->
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
.log-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 40rpx;
|
||||||
|
}
|
||||||
|
.log-item {
|
||||||
|
margin: 10rpx;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||||
|
"rules": [{
|
||||||
|
"action": "allow",
|
||||||
|
"page": "*"
|
||||||
|
}]
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
export const formatTime = (date: Date) => {
|
||||||
|
const year = date.getFullYear()
|
||||||
|
const month = date.getMonth() + 1
|
||||||
|
const day = date.getDate()
|
||||||
|
const hour = date.getHours()
|
||||||
|
const minute = date.getMinutes()
|
||||||
|
const second = date.getSeconds()
|
||||||
|
|
||||||
|
return (
|
||||||
|
[year, month, day].map(formatNumber).join('/') +
|
||||||
|
' ' +
|
||||||
|
[hour, minute, second].map(formatNumber).join(':')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatNumber = (n: number) => {
|
||||||
|
const s = n.toString()
|
||||||
|
return s[1] ? s : '0' + s
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"name": "miniprogram-ts-less-quickstart",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"scripts": {
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "",
|
||||||
|
"dependencies": {
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"miniprogram-api-typings": "^2.8.3-1"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"description": "项目配置文件",
|
||||||
|
"packOptions": {
|
||||||
|
"ignore": [],
|
||||||
|
"include": []
|
||||||
|
},
|
||||||
|
"miniprogramRoot": "miniprogram/",
|
||||||
|
"compileType": "miniprogram",
|
||||||
|
"projectname": "ts-sass-demo",
|
||||||
|
"setting": {
|
||||||
|
"useCompilerPlugins": [
|
||||||
|
"typescript",
|
||||||
|
"sass"
|
||||||
|
],
|
||||||
|
"babelSetting": {
|
||||||
|
"ignore": [],
|
||||||
|
"disablePlugins": [],
|
||||||
|
"outputPath": ""
|
||||||
|
},
|
||||||
|
"condition": false
|
||||||
|
},
|
||||||
|
"simulatorType": "wechat",
|
||||||
|
"simulatorPluginLibVersion": {},
|
||||||
|
"condition": {},
|
||||||
|
"srcMiniprogramRoot": "miniprogram/",
|
||||||
|
"appid": "wx83139b5b5deb646d",
|
||||||
|
"libVersion": "3.1.3",
|
||||||
|
"editorSetting": {
|
||||||
|
"tabIndent": "insertSpaces",
|
||||||
|
"tabSize": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
||||||
|
"projectname": "wxprogram1",
|
||||||
|
"setting": {
|
||||||
|
"compileHotReLoad": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"module": "CommonJS",
|
||||||
|
"target": "ES2020",
|
||||||
|
"allowJs": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"alwaysStrict": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"strict": true,
|
||||||
|
"strictPropertyInitialization": true,
|
||||||
|
"lib": ["ES2020"],
|
||||||
|
"typeRoots": [
|
||||||
|
"./typings"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"./**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
/// <reference path="./types/index.d.ts" />
|
||||||
|
|
||||||
|
interface IAppOption {
|
||||||
|
globalData: {
|
||||||
|
userInfo?: WechatMiniprogram.UserInfo,
|
||||||
|
}
|
||||||
|
userInfoReadyCallback?: WechatMiniprogram.GetUserInfoSuccessCallback,
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/// <reference path="./wx/index.d.ts" />
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2023 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
/// <reference path="./lib.wx.app.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.page.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.api.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.cloud.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.canvas.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.component.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.behavior.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.event.d.ts" />
|
||||||
|
/// <reference path="./lib.wx.wasm.d.ts" />
|
||||||
|
|
||||||
|
declare namespace WechatMiniprogram {
|
||||||
|
type IAnyObject = Record<string, any>
|
||||||
|
type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
|
||||||
|
type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
|
||||||
|
interface AsyncMethodOptionLike {
|
||||||
|
success?: (...args: any[]) => void
|
||||||
|
}
|
||||||
|
type PromisifySuccessResult<
|
||||||
|
P,
|
||||||
|
T extends AsyncMethodOptionLike
|
||||||
|
> = P extends {
|
||||||
|
success: any
|
||||||
|
}
|
||||||
|
? void
|
||||||
|
: P extends { fail: any }
|
||||||
|
? void
|
||||||
|
: P extends { complete: any }
|
||||||
|
? void
|
||||||
|
: Promise<Parameters<Exclude<T['success'], undefined>>[0]>
|
||||||
|
|
||||||
|
// TODO: Extract real definition from `lib.dom.d.ts` to replace this
|
||||||
|
type IIRFilterNode = any
|
||||||
|
type WaveShaperNode = any
|
||||||
|
type ConstantSourceNode = any
|
||||||
|
type OscillatorNode = any
|
||||||
|
type GainNode = any
|
||||||
|
type BiquadFilterNode = any
|
||||||
|
type PeriodicWaveNode = any
|
||||||
|
type AudioNode = any
|
||||||
|
type ChannelSplitterNode = any
|
||||||
|
type ChannelMergerNode = any
|
||||||
|
type DelayNode = any
|
||||||
|
type DynamicsCompressorNode = any
|
||||||
|
type ScriptProcessorNode = any
|
||||||
|
type PannerNode = any
|
||||||
|
type AnalyserNode = any
|
||||||
|
type AudioListener = any
|
||||||
|
type WebGLTexture = any
|
||||||
|
type WebGLRenderingContext = any
|
||||||
|
|
||||||
|
// TODO: fill worklet type
|
||||||
|
type WorkletFunction = (...args: any) => any
|
||||||
|
type AnimationObject = any
|
||||||
|
type SharedValue<T = any> = T
|
||||||
|
type DerivedValue<T = any> = T
|
||||||
|
}
|
||||||
|
|
||||||
|
declare let console: WechatMiniprogram.Console
|
||||||
|
|
||||||
|
declare let wx: WechatMiniprogram.Wx
|
||||||
|
/** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
|
||||||
|
interface Require {
|
||||||
|
(
|
||||||
|
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
|
||||||
|
module: string,
|
||||||
|
/** 用于异步获取其他分包中的模块的引用结果,详见 [分包异步化]((subpackages/async)) */
|
||||||
|
callback?: (moduleExport: any) => void,
|
||||||
|
/** 异步获取分包失败时的回调,详见 [分包异步化]((subpackages/async)) */
|
||||||
|
errorCallback?: (err: any) => void
|
||||||
|
): any
|
||||||
|
/** 以 Promise 形式异步引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
|
||||||
|
async(
|
||||||
|
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
|
||||||
|
module: string
|
||||||
|
): Promise<any>
|
||||||
|
}
|
||||||
|
declare const require: Require
|
||||||
|
/** 引入插件。返回插件通过 `main` 暴露的接口。 */
|
||||||
|
interface RequirePlugin {
|
||||||
|
(
|
||||||
|
/** 需要引入的插件的 alias */
|
||||||
|
module: string,
|
||||||
|
/** 用于异步获取其他分包中的插件的引用结果,详见 [分包异步化]((subpackages/async)) */
|
||||||
|
callback?: (pluginExport: any) => void
|
||||||
|
): any
|
||||||
|
/** 以 Promise 形式异步引入插件。返回插件通过 `main` 暴露的接口。 */
|
||||||
|
async(
|
||||||
|
/** 需要引入的插件的 alias */
|
||||||
|
module: string
|
||||||
|
): Promise<any>
|
||||||
|
}
|
||||||
|
declare const requirePlugin: RequirePlugin
|
||||||
|
/** 插件引入当前使用者小程序。返回使用者小程序通过 [插件配置中 `export` 暴露的接口](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6)。
|
||||||
|
*
|
||||||
|
* 该接口只在插件中存在
|
||||||
|
*
|
||||||
|
* 最低基础库: `2.11.1` */
|
||||||
|
declare function requireMiniProgram(): any
|
||||||
|
/** 当前模块对象 */
|
||||||
|
declare let module: {
|
||||||
|
/** 模块向外暴露的对象,使用 `require` 引用该模块时可以获取 */
|
||||||
|
exports: any
|
||||||
|
}
|
||||||
|
/** `module.exports` 的引用 */
|
||||||
|
declare let exports: any
|
||||||
|
|
||||||
|
/** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html)
|
||||||
|
*
|
||||||
|
* 取消由 setInterval 设置的定时器。 */
|
||||||
|
declare function clearInterval(
|
||||||
|
/** 要取消的定时器的 ID */
|
||||||
|
intervalID: number
|
||||||
|
): void
|
||||||
|
/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html)
|
||||||
|
*
|
||||||
|
* 取消由 setTimeout 设置的定时器。 */
|
||||||
|
declare function clearTimeout(
|
||||||
|
/** 要取消的定时器的 ID */
|
||||||
|
timeoutID: number
|
||||||
|
): void
|
||||||
|
/** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html)
|
||||||
|
*
|
||||||
|
* 设定一个定时器。按照指定的周期(以毫秒计)来执行注册的回调函数 */
|
||||||
|
declare function setInterval(
|
||||||
|
/** 回调函数 */
|
||||||
|
callback: (...args: any[]) => any,
|
||||||
|
/** 执行回调函数之间的时间间隔,单位 ms。 */
|
||||||
|
delay?: number,
|
||||||
|
/** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
|
||||||
|
rest?: any
|
||||||
|
): number
|
||||||
|
/** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html)
|
||||||
|
*
|
||||||
|
* 设定一个定时器。在定时到期以后执行注册的回调函数 */
|
||||||
|
declare function setTimeout(
|
||||||
|
/** 回调函数 */
|
||||||
|
callback: (...args: any[]) => any,
|
||||||
|
/** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
|
||||||
|
delay?: number,
|
||||||
|
/** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
|
||||||
|
rest?: any
|
||||||
|
): number
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2023 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
declare namespace WechatMiniprogram.App {
|
||||||
|
type SceneValues =
|
||||||
|
| 1000
|
||||||
|
| 1001
|
||||||
|
| 1005
|
||||||
|
| 1006
|
||||||
|
| 1007
|
||||||
|
| 1008
|
||||||
|
| 1010
|
||||||
|
| 1011
|
||||||
|
| 1012
|
||||||
|
| 1013
|
||||||
|
| 1014
|
||||||
|
| 1017
|
||||||
|
| 1019
|
||||||
|
| 1020
|
||||||
|
| 1022
|
||||||
|
| 1023
|
||||||
|
| 1024
|
||||||
|
| 1025
|
||||||
|
| 1026
|
||||||
|
| 1027
|
||||||
|
| 1028
|
||||||
|
| 1029
|
||||||
|
| 1030
|
||||||
|
| 1031
|
||||||
|
| 1032
|
||||||
|
| 1034
|
||||||
|
| 1035
|
||||||
|
| 1036
|
||||||
|
| 1037
|
||||||
|
| 1038
|
||||||
|
| 1039
|
||||||
|
| 1042
|
||||||
|
| 1043
|
||||||
|
| 1044
|
||||||
|
| 1045
|
||||||
|
| 1046
|
||||||
|
| 1047
|
||||||
|
| 1048
|
||||||
|
| 1049
|
||||||
|
| 1052
|
||||||
|
| 1053
|
||||||
|
| 1054
|
||||||
|
| 1056
|
||||||
|
| 1057
|
||||||
|
| 1058
|
||||||
|
| 1059
|
||||||
|
| 1060
|
||||||
|
| 1064
|
||||||
|
| 1065
|
||||||
|
| 1067
|
||||||
|
| 1068
|
||||||
|
| 1069
|
||||||
|
| 1071
|
||||||
|
| 1072
|
||||||
|
| 1073
|
||||||
|
| 1074
|
||||||
|
| 1077
|
||||||
|
| 1078
|
||||||
|
| 1079
|
||||||
|
| 1081
|
||||||
|
| 1082
|
||||||
|
| 1084
|
||||||
|
| 1088
|
||||||
|
| 1089
|
||||||
|
| 1090
|
||||||
|
| 1091
|
||||||
|
| 1092
|
||||||
|
| 1095
|
||||||
|
| 1096
|
||||||
|
| 1097
|
||||||
|
| 1099
|
||||||
|
| 1100
|
||||||
|
| 1101
|
||||||
|
| 1102
|
||||||
|
| 1103
|
||||||
|
| 1104
|
||||||
|
| 1106
|
||||||
|
| 1107
|
||||||
|
| 1113
|
||||||
|
| 1114
|
||||||
|
| 1119
|
||||||
|
| 1120
|
||||||
|
| 1121
|
||||||
|
| 1124
|
||||||
|
| 1125
|
||||||
|
| 1126
|
||||||
|
| 1129
|
||||||
|
| 1131
|
||||||
|
| 1133
|
||||||
|
| 1135
|
||||||
|
| 1144
|
||||||
|
| 1145
|
||||||
|
| 1146
|
||||||
|
| 1148
|
||||||
|
| 1150
|
||||||
|
| 1151
|
||||||
|
| 1152
|
||||||
|
| 1153
|
||||||
|
| 1154
|
||||||
|
| 1155
|
||||||
|
| 1157
|
||||||
|
| 1158
|
||||||
|
| 1160
|
||||||
|
| 1167
|
||||||
|
| 1168
|
||||||
|
| 1169
|
||||||
|
| 1171
|
||||||
|
| 1173
|
||||||
|
| 1175
|
||||||
|
| 1176
|
||||||
|
| 1177
|
||||||
|
| 1178
|
||||||
|
| 1179
|
||||||
|
| 1181
|
||||||
|
| 1183
|
||||||
|
| 1184
|
||||||
|
| 1185
|
||||||
|
| 1186
|
||||||
|
| 1187
|
||||||
|
| 1189
|
||||||
|
| 1191
|
||||||
|
| 1192
|
||||||
|
| 1193
|
||||||
|
| 1194
|
||||||
|
| 1195
|
||||||
|
| 1196
|
||||||
|
| 1197
|
||||||
|
| 1198
|
||||||
|
| 1200
|
||||||
|
| 1201
|
||||||
|
| 1202
|
||||||
|
| 1203
|
||||||
|
| 1206
|
||||||
|
| 1207
|
||||||
|
| 1208
|
||||||
|
| 1212
|
||||||
|
| 1215
|
||||||
|
| 1216
|
||||||
|
| 1223
|
||||||
|
| 1228
|
||||||
|
| 1231
|
||||||
|
|
||||||
|
interface LaunchShowOption {
|
||||||
|
/** 打开小程序的路径 */
|
||||||
|
path: string
|
||||||
|
/** 打开小程序的query */
|
||||||
|
query: IAnyObject
|
||||||
|
/** 打开小程序的场景值
|
||||||
|
* - 1000:其他
|
||||||
|
* - 1001:发现栏小程序主入口,「最近使用」列表(基础库 2.2.4 版本起包含「我的小程序」列表)
|
||||||
|
* - 1005:微信首页顶部搜索框的搜索结果页
|
||||||
|
* - 1006:发现栏小程序主入口搜索框的搜索结果页
|
||||||
|
* - 1007:单人聊天会话中的小程序消息卡片
|
||||||
|
* - 1008:群聊会话中的小程序消息卡片
|
||||||
|
* - 1010:收藏夹
|
||||||
|
* - 1011:扫描二维码
|
||||||
|
* - 1012:长按图片识别二维码
|
||||||
|
* - 1013:扫描手机相册中选取的二维码
|
||||||
|
* - 1014:小程序订阅消息(与 1107 相同)
|
||||||
|
* - 1017:前往小程序体验版的入口页
|
||||||
|
* - 1019:微信钱包(微信客户端 7.0.0 版本改为支付入口)
|
||||||
|
* - 1020:公众号 profile 页相关小程序列表(已废弃)
|
||||||
|
* - 1022:聊天顶部置顶小程序入口(微信客户端 6.6.1 版本起废弃)
|
||||||
|
* - 1023:安卓系统桌面图标
|
||||||
|
* - 1024:小程序 profile 页
|
||||||
|
* - 1025:扫描一维码
|
||||||
|
* - 1026:发现栏小程序主入口,「附近的小程序」列表
|
||||||
|
* - 1027:微信首页顶部搜索框搜索结果页「使用过的小程序」列表
|
||||||
|
* - 1028:我的卡包
|
||||||
|
* - 1029:小程序中的卡券详情页
|
||||||
|
* - 1030:自动化测试下打开小程序
|
||||||
|
* - 1031:长按图片识别一维码
|
||||||
|
* - 1032:扫描手机相册中选取的一维码
|
||||||
|
* - 1034:微信支付完成页
|
||||||
|
* - 1035:公众号自定义菜单
|
||||||
|
* - 1036:App 分享消息卡片
|
||||||
|
* - 1037:小程序打开小程序
|
||||||
|
* - 1038:从另一个小程序返回
|
||||||
|
* - 1039:摇电视
|
||||||
|
* - 1042:添加好友搜索框的搜索结果页
|
||||||
|
* - 1043:公众号模板消息
|
||||||
|
* - 1044:带 shareTicket 的小程序消息卡片 [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html)
|
||||||
|
* - 1045:朋友圈广告
|
||||||
|
* - 1046:朋友圈广告详情页
|
||||||
|
* - 1047:扫描小程序码
|
||||||
|
* - 1048:长按图片识别小程序码
|
||||||
|
* - 1049:扫描手机相册中选取的小程序码
|
||||||
|
* - 1052:卡券的适用门店列表
|
||||||
|
* - 1053:搜一搜的结果页
|
||||||
|
* - 1054:顶部搜索框小程序快捷入口(微信客户端版本 6.7.4 起废弃)
|
||||||
|
* - 1056:聊天顶部音乐播放器右上角菜单
|
||||||
|
* - 1057:钱包中的银行卡详情页
|
||||||
|
* - 1058:公众号文章
|
||||||
|
* - 1059:体验版小程序绑定邀请页
|
||||||
|
* - 1060:微信支付完成页(与 1034 相同)
|
||||||
|
* - 1064:微信首页连 Wi-Fi 状态栏
|
||||||
|
* - 1065:URL scheme [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-scheme.html)
|
||||||
|
* - 1067:公众号文章广告
|
||||||
|
* - 1068:附近小程序列表广告(已废弃)
|
||||||
|
* - 1069:移动应用通过 openSDK 进入微信,打开小程序
|
||||||
|
* - 1071:钱包中的银行卡列表页
|
||||||
|
* - 1072:二维码收款页面
|
||||||
|
* - 1073:客服消息列表下发的小程序消息卡片
|
||||||
|
* - 1074:公众号会话下发的小程序消息卡片
|
||||||
|
* - 1077:摇周边
|
||||||
|
* - 1078:微信连 Wi-Fi 成功提示页
|
||||||
|
* - 1079:微信游戏中心
|
||||||
|
* - 1081:客服消息下发的文字链
|
||||||
|
* - 1082:公众号会话下发的文字链
|
||||||
|
* - 1084:朋友圈广告原生页
|
||||||
|
* - 1088:会话中查看系统消息,打开小程序
|
||||||
|
* - 1089:微信聊天主界面下拉,「最近使用」栏(基础库 2.2.4 版本起包含「我的小程序」栏)
|
||||||
|
* - 1090:长按小程序右上角菜单唤出最近使用历史
|
||||||
|
* - 1091:公众号文章商品卡片
|
||||||
|
* - 1092:城市服务入口
|
||||||
|
* - 1095:小程序广告组件
|
||||||
|
* - 1096:聊天记录,打开小程序
|
||||||
|
* - 1097:微信支付签约原生页,打开小程序
|
||||||
|
* - 1099:页面内嵌插件
|
||||||
|
* - 1100:红包封面详情页打开小程序
|
||||||
|
* - 1101:远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)
|
||||||
|
* - 1102:公众号 profile 页服务预览
|
||||||
|
* - 1103:发现栏小程序主入口,「我的小程序」列表(基础库 2.2.4 版本起废弃)
|
||||||
|
* - 1104:微信聊天主界面下拉,「我的小程序」栏(基础库 2.2.4 版本起废弃)
|
||||||
|
* - 1106:聊天主界面下拉,从顶部搜索结果页,打开小程序
|
||||||
|
* - 1107:订阅消息,打开小程序
|
||||||
|
* - 1113:安卓手机负一屏,打开小程序(三星)
|
||||||
|
* - 1114:安卓手机侧边栏,打开小程序(三星)
|
||||||
|
* - 1119:【企业微信】工作台内打开小程序
|
||||||
|
* - 1120:【企业微信】个人资料页内打开小程序
|
||||||
|
* - 1121:【企业微信】聊天加号附件框内打开小程序
|
||||||
|
* - 1124:扫“一物一码”打开小程序
|
||||||
|
* - 1125:长按图片识别“一物一码”
|
||||||
|
* - 1126:扫描手机相册中选取的“一物一码”
|
||||||
|
* - 1129:微信爬虫访问 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html)
|
||||||
|
* - 1131:浮窗(8.0 版本起仅包含被动浮窗)
|
||||||
|
* - 1133:硬件设备打开小程序 [详情](https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/)
|
||||||
|
* - 1135:小程序 profile 页相关小程序列表,打开小程序
|
||||||
|
* - 1144:公众号文章 - 视频贴片
|
||||||
|
* - 1145:发现栏 - 发现小程序
|
||||||
|
* - 1146:地理位置信息打开出行类小程序
|
||||||
|
* - 1148:卡包-交通卡,打开小程序
|
||||||
|
* - 1150:扫一扫商品条码结果页打开小程序
|
||||||
|
* - 1151:发现栏 - 我的订单
|
||||||
|
* - 1152:订阅号视频打开小程序
|
||||||
|
* - 1153:“识物”结果页打开小程序
|
||||||
|
* - 1154:朋友圈内打开“单页模式”
|
||||||
|
* - 1155:“单页模式”打开小程序
|
||||||
|
* - 1157:服务号会话页打开小程序
|
||||||
|
* - 1158:群工具打开小程序
|
||||||
|
* - 1160:群待办
|
||||||
|
* - 1167:H5 通过开放标签打开小程序 [详情](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html)
|
||||||
|
* - 1168:移动应用直接运行小程序
|
||||||
|
* - 1169:发现栏小程序主入口,各个生活服务入口(例如快递服务、出行服务等)
|
||||||
|
* - 1171:微信运动记录(仅安卓)
|
||||||
|
* - 1173:聊天素材用小程序打开 [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/material/support_material.html)
|
||||||
|
* - 1175:视频号主页商店入口
|
||||||
|
* - 1176:视频号直播间主播打开小程序
|
||||||
|
* - 1177:视频号直播商品
|
||||||
|
* - 1178:在电脑打开手机上打开的小程序
|
||||||
|
* - 1179:#话题页打开小程序
|
||||||
|
* - 1181:网站应用打开 PC 小程序
|
||||||
|
* - 1183:PC 微信 - 小程序面板 - 发现小程序 - 搜索
|
||||||
|
* - 1184:视频号链接打开小程序
|
||||||
|
* - 1185:群公告
|
||||||
|
* - 1186:收藏 - 笔记
|
||||||
|
* - 1187:浮窗(8.0 版本起)
|
||||||
|
* - 1189:表情雨广告
|
||||||
|
* - 1191:视频号活动
|
||||||
|
* - 1192:企业微信联系人 profile 页
|
||||||
|
* - 1193:视频号主页服务菜单打开小程序
|
||||||
|
* - 1194:URL Link [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-link.html)
|
||||||
|
* - 1195:视频号主页商品 tab
|
||||||
|
* - 1196:个人状态打开小程序
|
||||||
|
* - 1197:视频号主播从直播间返回小游戏
|
||||||
|
* - 1198:视频号开播界面打开小游戏
|
||||||
|
* - 1200:视频号广告打开小程序
|
||||||
|
* - 1201:视频号广告详情页打开小程序
|
||||||
|
* - 1202:企微客服号会话打开小程序卡片
|
||||||
|
* - 1203:微信小程序压测工具的请求
|
||||||
|
* - 1206:视频号小游戏直播间打开小游戏
|
||||||
|
* - 1207:企微客服号会话打开小程序文字链
|
||||||
|
* - 1208:聊天打开商品卡片
|
||||||
|
* - 1212:青少年模式申请页打开小程序
|
||||||
|
* - 1215:广告预约打开小程序
|
||||||
|
* - 1216:视频号订单中心打开小程序
|
||||||
|
* - 1223:安卓桌面 Widget 打开小程序
|
||||||
|
* - 1228:视频号原生广告组件打开小程序
|
||||||
|
* - 1231:动态消息提醒入口打开小程序
|
||||||
|
*/
|
||||||
|
scene: SceneValues
|
||||||
|
/** shareTicket,详见 [获取更多转发信息]((转发#获取更多转发信息)) */
|
||||||
|
shareTicket: string
|
||||||
|
/** 当场景为由从另一个小程序或公众号或App打开时,返回此字段 */
|
||||||
|
referrerInfo?: ReferrerInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PageNotFoundOption {
|
||||||
|
/** 不存在页面的路径 */
|
||||||
|
path: string
|
||||||
|
/** 打开不存在页面的 query */
|
||||||
|
query: IAnyObject
|
||||||
|
/** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
|
||||||
|
isEntryPage: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Option {
|
||||||
|
/** 生命周期回调—监听小程序初始化
|
||||||
|
*
|
||||||
|
* 小程序初始化完成时触发,全局只触发一次。
|
||||||
|
*/
|
||||||
|
onLaunch(options: LaunchShowOption): void
|
||||||
|
/** 生命周期回调—监听小程序显示
|
||||||
|
*
|
||||||
|
* 小程序启动,或从后台进入前台显示时
|
||||||
|
*/
|
||||||
|
onShow(options: LaunchShowOption): void
|
||||||
|
/** 生命周期回调—监听小程序隐藏
|
||||||
|
*
|
||||||
|
* 小程序从前台进入后台时
|
||||||
|
*/
|
||||||
|
onHide(): void
|
||||||
|
/** 错误监听函数
|
||||||
|
*
|
||||||
|
* 小程序发生脚本错误,或者 api
|
||||||
|
*/
|
||||||
|
onError(/** 错误信息,包含堆栈 */ error: string): void
|
||||||
|
/** 页面不存在监听函数
|
||||||
|
*
|
||||||
|
* 小程序要打开的页面不存在时触发,会带上页面信息回调该函数
|
||||||
|
*
|
||||||
|
* **注意:**
|
||||||
|
* 1. 如果开发者没有添加 `onPageNotFound` 监听,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
|
||||||
|
* 2. 如果 `onPageNotFound` 回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再回调 `onPageNotFound`。
|
||||||
|
*
|
||||||
|
* 最低基础库: 1.9.90
|
||||||
|
*/
|
||||||
|
onPageNotFound(options: PageNotFoundOption): void
|
||||||
|
/**
|
||||||
|
* 小程序有未处理的 Promise 拒绝时触发。也可以使用 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 绑定监听。注意事项请参考 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)。
|
||||||
|
* **参数**:与 [wx.onUnhandledRejection](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html) 一致
|
||||||
|
*/
|
||||||
|
onUnhandledRejection: OnUnhandledRejectionCallback
|
||||||
|
/**
|
||||||
|
* 系统切换主题时触发。也可以使用 wx.onThemeChange 绑定监听。
|
||||||
|
*
|
||||||
|
* 最低基础库: 2.11.0
|
||||||
|
*/
|
||||||
|
onThemeChange: OnThemeChangeCallback
|
||||||
|
}
|
||||||
|
|
||||||
|
type Instance<T extends IAnyObject> = Option & T
|
||||||
|
type Options<T extends IAnyObject> = Partial<Option> &
|
||||||
|
T &
|
||||||
|
ThisType<Instance<T>>
|
||||||
|
type TrivialInstance = Instance<IAnyObject>
|
||||||
|
|
||||||
|
interface Constructor {
|
||||||
|
<T extends IAnyObject>(options: Options<T>): void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetAppOption {
|
||||||
|
/** 在 `App` 未定义时返回默认实现。当App被调用时,默认实现中定义的属性会被覆盖合并到App中。一般用于独立分包
|
||||||
|
*
|
||||||
|
* 最低基础库: 2.2.4
|
||||||
|
*/
|
||||||
|
allowDefault?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetApp {
|
||||||
|
<T extends IAnyObject = IAnyObject>(opts?: GetAppOption): Instance<T>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare let App: WechatMiniprogram.App.Constructor
|
||||||
|
declare let getApp: WechatMiniprogram.App.GetApp
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2023 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
declare namespace WechatMiniprogram.Behavior {
|
||||||
|
type BehaviorIdentifier = string
|
||||||
|
type Instance<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||||
|
> = Component.Instance<TData, TProperty, TMethod, TCustomInstanceProperty>
|
||||||
|
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject>
|
||||||
|
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject>
|
||||||
|
type Options<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||||
|
> = Partial<Data<TData>> &
|
||||||
|
Partial<Property<TProperty>> &
|
||||||
|
Partial<Method<TMethod>> &
|
||||||
|
Partial<OtherOption> &
|
||||||
|
Partial<Lifetimes> &
|
||||||
|
ThisType<Instance<TData, TProperty, TMethod, TCustomInstanceProperty>>
|
||||||
|
interface Constructor {
|
||||||
|
<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||||
|
>(
|
||||||
|
options: Options<TData, TProperty, TMethod, TCustomInstanceProperty>
|
||||||
|
): BehaviorIdentifier
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataOption = Component.DataOption
|
||||||
|
type PropertyOption = Component.PropertyOption
|
||||||
|
type MethodOption = Component.MethodOption
|
||||||
|
type Data<D extends DataOption> = Component.Data<D>
|
||||||
|
type Property<P extends PropertyOption> = Component.Property<P>
|
||||||
|
type Method<M extends MethodOption> = Component.Method<M>
|
||||||
|
|
||||||
|
type DefinitionFilter = Component.DefinitionFilter
|
||||||
|
type Lifetimes = Component.Lifetimes
|
||||||
|
|
||||||
|
type OtherOption = Omit<Component.OtherOption, 'options'>
|
||||||
|
}
|
||||||
|
/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
|
||||||
|
declare let Behavior: WechatMiniprogram.Behavior.Constructor
|
||||||
@@ -0,0 +1,700 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2023 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
declare namespace WechatMiniprogram.Component {
|
||||||
|
type Instance<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends Partial<MethodOption>,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = {},
|
||||||
|
TIsPage extends boolean = false
|
||||||
|
> = InstanceProperties &
|
||||||
|
InstanceMethods<TData> &
|
||||||
|
TMethod &
|
||||||
|
(TIsPage extends true ? Page.ILifetime : {}) &
|
||||||
|
TCustomInstanceProperty & {
|
||||||
|
/** 组件数据,**包括内部数据和属性值** */
|
||||||
|
data: TData & PropertyOptionToData<TProperty>
|
||||||
|
/** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */
|
||||||
|
properties: TData & PropertyOptionToData<TProperty>
|
||||||
|
}
|
||||||
|
type TrivialInstance = Instance<
|
||||||
|
IAnyObject,
|
||||||
|
IAnyObject,
|
||||||
|
IAnyObject,
|
||||||
|
IAnyObject
|
||||||
|
>
|
||||||
|
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, IAnyObject>
|
||||||
|
type Options<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = {},
|
||||||
|
TIsPage extends boolean = false
|
||||||
|
> = Partial<Data<TData>> &
|
||||||
|
Partial<Property<TProperty>> &
|
||||||
|
Partial<Method<TMethod, TIsPage>> &
|
||||||
|
Partial<OtherOption> &
|
||||||
|
Partial<Lifetimes> &
|
||||||
|
ThisType<
|
||||||
|
Instance<
|
||||||
|
TData,
|
||||||
|
TProperty,
|
||||||
|
TMethod,
|
||||||
|
TCustomInstanceProperty,
|
||||||
|
TIsPage
|
||||||
|
>
|
||||||
|
>
|
||||||
|
interface Constructor {
|
||||||
|
<
|
||||||
|
TData extends DataOption,
|
||||||
|
TProperty extends PropertyOption,
|
||||||
|
TMethod extends MethodOption,
|
||||||
|
TCustomInstanceProperty extends IAnyObject = {},
|
||||||
|
TIsPage extends boolean = false
|
||||||
|
>(
|
||||||
|
options: Options<
|
||||||
|
TData,
|
||||||
|
TProperty,
|
||||||
|
TMethod,
|
||||||
|
TCustomInstanceProperty,
|
||||||
|
TIsPage
|
||||||
|
>
|
||||||
|
): string
|
||||||
|
}
|
||||||
|
type DataOption = Record<string, any>
|
||||||
|
type PropertyOption = Record<string, AllProperty>
|
||||||
|
type MethodOption = Record<string, Function>
|
||||||
|
|
||||||
|
interface Data<D extends DataOption> {
|
||||||
|
/** 组件的内部数据,和 `properties` 一同用于组件的模板渲染 */
|
||||||
|
data?: D
|
||||||
|
}
|
||||||
|
interface Property<P extends PropertyOption> {
|
||||||
|
/** 组件的对外属性,是属性名到属性设置的映射表 */
|
||||||
|
properties: P
|
||||||
|
}
|
||||||
|
interface Method<M extends MethodOption, TIsPage extends boolean = false> {
|
||||||
|
/** 组件的方法,包括事件响应函数和任意的自定义方法,关于事件响应函数的使用,参见 [组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */
|
||||||
|
methods: M & (TIsPage extends true ? Partial<Page.ILifetime> : {})
|
||||||
|
}
|
||||||
|
type PropertyType =
|
||||||
|
| StringConstructor
|
||||||
|
| NumberConstructor
|
||||||
|
| BooleanConstructor
|
||||||
|
| ArrayConstructor
|
||||||
|
| ObjectConstructor
|
||||||
|
| null
|
||||||
|
type ValueType<T extends PropertyType> = T extends null
|
||||||
|
? any
|
||||||
|
: T extends StringConstructor
|
||||||
|
? string
|
||||||
|
: T extends NumberConstructor
|
||||||
|
? number
|
||||||
|
: T extends BooleanConstructor
|
||||||
|
? boolean
|
||||||
|
: T extends ArrayConstructor
|
||||||
|
? any[]
|
||||||
|
: T extends ObjectConstructor
|
||||||
|
? IAnyObject
|
||||||
|
: never
|
||||||
|
type FullProperty<T extends PropertyType> = {
|
||||||
|
/** 属性类型 */
|
||||||
|
type: T
|
||||||
|
/** 属性初始值 */
|
||||||
|
value?: ValueType<T>
|
||||||
|
/** 属性值被更改时的响应函数 */
|
||||||
|
observer?:
|
||||||
|
| string
|
||||||
|
| ((
|
||||||
|
newVal: ValueType<T>,
|
||||||
|
oldVal: ValueType<T>,
|
||||||
|
changedPath: Array<string | number>
|
||||||
|
) => void)
|
||||||
|
/** 属性的类型(可以指定多个) */
|
||||||
|
optionalTypes?: ShortProperty[]
|
||||||
|
}
|
||||||
|
type AllFullProperty =
|
||||||
|
| FullProperty<StringConstructor>
|
||||||
|
| FullProperty<NumberConstructor>
|
||||||
|
| FullProperty<BooleanConstructor>
|
||||||
|
| FullProperty<ArrayConstructor>
|
||||||
|
| FullProperty<ObjectConstructor>
|
||||||
|
| FullProperty<null>
|
||||||
|
type ShortProperty =
|
||||||
|
| StringConstructor
|
||||||
|
| NumberConstructor
|
||||||
|
| BooleanConstructor
|
||||||
|
| ArrayConstructor
|
||||||
|
| ObjectConstructor
|
||||||
|
| null
|
||||||
|
type AllProperty = AllFullProperty | ShortProperty
|
||||||
|
type PropertyToData<T extends AllProperty> = T extends ShortProperty
|
||||||
|
? ValueType<T>
|
||||||
|
: FullPropertyToData<Exclude<T, ShortProperty>>
|
||||||
|
type FullPropertyToData<T extends AllFullProperty> = ValueType<T['type']>
|
||||||
|
// type FullPropertyToData<T extends AllFullProperty> = unknown extends T['value'] ? ValueType<T['type']> : T['value']
|
||||||
|
type PropertyOptionToData<P extends PropertyOption> = {
|
||||||
|
[name in keyof P]: PropertyToData<P[name]>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InstanceProperties {
|
||||||
|
/** 组件的文件路径 */
|
||||||
|
is: string
|
||||||
|
/** 节点id */
|
||||||
|
id: string
|
||||||
|
/** 节点dataset */
|
||||||
|
dataset: Record<string, string>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface InstanceMethods<D extends DataOption> {
|
||||||
|
/** `setData` 函数用于将数据从逻辑层发送到视图层
|
||||||
|
*(异步),同时改变对应的 `this.data` 的值(同步)。
|
||||||
|
*
|
||||||
|
* **注意:**
|
||||||
|
*
|
||||||
|
* 1. **直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致**。
|
||||||
|
* 1. 仅支持设置可 JSON 化的数据。
|
||||||
|
* 1. 单次设置的数据不能超过1024kB,请尽量避免一次设置过多的数据。
|
||||||
|
* 1. 请不要把 data 中任何一项的 value 设为 `undefined` ,否则这一项将不被设置并可能遗留一些潜在问题。
|
||||||
|
*/
|
||||||
|
setData(
|
||||||
|
/** 这次要改变的数据
|
||||||
|
*
|
||||||
|
* 以 `key: value` 的形式表示,将 `this.data` 中的 `key` 对应的值改变成 `value`。
|
||||||
|
*
|
||||||
|
* 其中 `key` 可以以数据路径的形式给出,支持改变数组中的某一项或对象的某个属性,如 `array[2].message`,`a.b.c.d`,并且不需要在 this.data 中预先定义。
|
||||||
|
*/
|
||||||
|
data: Partial<D> & IAnyObject,
|
||||||
|
/** setData引起的界面更新渲染完毕后的回调函数,最低基础库: `1.5.0` */
|
||||||
|
callback?: () => void
|
||||||
|
): void
|
||||||
|
|
||||||
|
/** 检查组件是否具有 `behavior` (检查时会递归检查被直接或间接引入的所有behavior) */
|
||||||
|
hasBehavior(behavior: Behavior.BehaviorIdentifier): void
|
||||||
|
/** 触发事件,参见组件事件 */
|
||||||
|
triggerEvent<DetailType = any>(
|
||||||
|
name: string,
|
||||||
|
detail?: DetailType,
|
||||||
|
options?: TriggerEventOption
|
||||||
|
): void
|
||||||
|
/** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
|
||||||
|
createSelectorQuery(): SelectorQuery
|
||||||
|
/** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
|
||||||
|
createIntersectionObserver(
|
||||||
|
options: CreateIntersectionObserverOption
|
||||||
|
): IntersectionObserver
|
||||||
|
/** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 `wx://component-export` 影响) */
|
||||||
|
selectComponent(selector: string): TrivialInstance
|
||||||
|
/** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 */
|
||||||
|
selectAllComponents(selector: string): TrivialInstance[]
|
||||||
|
/**
|
||||||
|
* 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 `wx://component-export` 影响)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.8.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
selectOwnerComponent(): TrivialInstance
|
||||||
|
/** 获取这个关系所对应的所有关联节点,参见 组件间关系 */
|
||||||
|
getRelationNodes(relationKey: string): TrivialInstance[]
|
||||||
|
/**
|
||||||
|
* 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.4.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
groupSetData(callback?: () => void): void
|
||||||
|
/**
|
||||||
|
* 返回当前页面的 custom-tab-bar 的组件实例
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.6.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
getTabBar(): TrivialInstance
|
||||||
|
/**
|
||||||
|
* 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.7.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
getPageId(): string
|
||||||
|
/**
|
||||||
|
* 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
animate(
|
||||||
|
selector: string,
|
||||||
|
keyFrames: KeyFrame[],
|
||||||
|
duration: number,
|
||||||
|
callback?: () => void
|
||||||
|
): void
|
||||||
|
/**
|
||||||
|
* 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
animate(
|
||||||
|
selector: string,
|
||||||
|
keyFrames: ScrollTimelineKeyframe[],
|
||||||
|
duration: number,
|
||||||
|
scrollTimeline: ScrollTimelineOption
|
||||||
|
): void
|
||||||
|
/**
|
||||||
|
* 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
clearAnimation(selector: string, callback: () => void): void
|
||||||
|
/**
|
||||||
|
* 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
**/
|
||||||
|
clearAnimation(
|
||||||
|
selector: string,
|
||||||
|
options?: ClearAnimationOptions,
|
||||||
|
callback?: () => void
|
||||||
|
): void
|
||||||
|
/**
|
||||||
|
* 当从另一页面跳转到该页面时,获得与来源页面实例通信当事件通道,详见 [wx.navigateTo]((wx.navigateTo))
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.7.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
getOpenerEventChannel(): EventChannel
|
||||||
|
/**
|
||||||
|
* 获取更新性能统计信息,详见 [获取更新性能统计信息]((custom-component/update-perf-stat))
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.12.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
setUpdatePerformanceListener<WithDataPath extends boolean = false>(
|
||||||
|
options: SetUpdatePerformanceListenerOption<WithDataPath>,
|
||||||
|
callback?: UpdatePerformanceListener<WithDataPath>
|
||||||
|
): void
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在运行时获取页面或组件所在页面 `touch` 相关事件的 passive 配置,详见 [enablePassiveEvent]((configuration/app#enablePassiveEvent))
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.25.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
getPassiveEvent(callback: (config: PassiveConfig) => void): void
|
||||||
|
/**
|
||||||
|
* 在运行时切换页面或组件所在页面 `touch` 相关事件的 passive 配置,详见 [enablePassiveEvent]((configuration/app#enablePassiveEvent))
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.25.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
setPassiveEvent(config: PassiveConfig): void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ComponentOptions {
|
||||||
|
/**
|
||||||
|
* [启用多slot支持](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件wxml的slot)
|
||||||
|
*/
|
||||||
|
multipleSlots?: boolean
|
||||||
|
/**
|
||||||
|
* [组件样式隔离](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件样式隔离)
|
||||||
|
*/
|
||||||
|
addGlobalClass?: boolean
|
||||||
|
/**
|
||||||
|
* [组件样式隔离](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#组件样式隔离)
|
||||||
|
*/
|
||||||
|
styleIsolation?:
|
||||||
|
| 'isolated'
|
||||||
|
| 'apply-shared'
|
||||||
|
| 'shared'
|
||||||
|
| 'page-isolated'
|
||||||
|
| 'page-apply-shared'
|
||||||
|
| 'page-shared'
|
||||||
|
/**
|
||||||
|
* [纯数据字段](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/pure-data.html) 是一些不用于界面渲染的 data 字段,可以用于提升页面更新性能。从小程序基础库版本 2.8.2 开始支持。
|
||||||
|
*/
|
||||||
|
pureDataPattern?: RegExp
|
||||||
|
/**
|
||||||
|
* [虚拟化组件节点](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html#%E8%99%9A%E6%8B%9F%E5%8C%96%E7%BB%84%E4%BB%B6%E8%8A%82%E7%82%B9) 使自定义组件内部的第一层节点由自定义组件本身完全决定。从小程序基础库版本 [`2.11.2`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持 */
|
||||||
|
virtualHost?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface TriggerEventOption {
|
||||||
|
/** 事件是否冒泡
|
||||||
|
*
|
||||||
|
* 默认值: `false`
|
||||||
|
*/
|
||||||
|
bubbles?: boolean
|
||||||
|
/** 事件是否可以穿越组件边界,为false时,事件将只能在引用组件的节点树上触发,不进入其他任何组件内部
|
||||||
|
*
|
||||||
|
* 默认值: `false`
|
||||||
|
*/
|
||||||
|
composed?: boolean
|
||||||
|
/** 事件是否拥有捕获阶段
|
||||||
|
*
|
||||||
|
* 默认值: `false`
|
||||||
|
*/
|
||||||
|
capturePhase?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RelationOption {
|
||||||
|
/** 目标组件的相对关系 */
|
||||||
|
type: 'parent' | 'child' | 'ancestor' | 'descendant'
|
||||||
|
/** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */
|
||||||
|
linked?(target: TrivialInstance): void
|
||||||
|
/** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */
|
||||||
|
linkChanged?(target: TrivialInstance): void
|
||||||
|
/** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */
|
||||||
|
unlinked?(target: TrivialInstance): void
|
||||||
|
/** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */
|
||||||
|
target?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PageLifetimes {
|
||||||
|
/** 页面生命周期回调—监听页面显示
|
||||||
|
*
|
||||||
|
* 页面显示/切入前台时触发。
|
||||||
|
*/
|
||||||
|
show(): void
|
||||||
|
/** 页面生命周期回调—监听页面隐藏
|
||||||
|
*
|
||||||
|
* 页面隐藏/切入后台时触发。 如 `navigateTo` 或底部 `tab` 切换到其他页面,小程序切入后台等。
|
||||||
|
*/
|
||||||
|
hide(): void
|
||||||
|
/** 页面生命周期回调—监听页面尺寸变化
|
||||||
|
*
|
||||||
|
* 所在页面尺寸变化时执行
|
||||||
|
*/
|
||||||
|
resize(size: Page.IResizeOption): void
|
||||||
|
}
|
||||||
|
|
||||||
|
type DefinitionFilter = <T extends TrivialOption>(
|
||||||
|
/** 使用该 behavior 的 component/behavior 的定义对象 */
|
||||||
|
defFields: T,
|
||||||
|
/** 该 behavior 所使用的 behavior 的 definitionFilter 函数列表 */
|
||||||
|
definitionFilterArr?: DefinitionFilter[]
|
||||||
|
) => void
|
||||||
|
|
||||||
|
interface Lifetimes {
|
||||||
|
/** 组件生命周期声明对象,组件的生命周期:`created`、`attached`、`ready`、`moved`、`detached` 将收归到 `lifetimes` 字段内进行声明,原有声明方式仍旧有效,如同时存在两种声明方式,则 `lifetimes` 字段内声明方式优先级最高
|
||||||
|
*
|
||||||
|
* 最低基础库: `2.2.3` */
|
||||||
|
lifetimes: Partial<{
|
||||||
|
/**
|
||||||
|
* 在组件实例刚刚被创建时执行,注意此时不能调用 `setData`
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
created(): void
|
||||||
|
/**
|
||||||
|
* 在组件实例进入页面节点树时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
attached(): void
|
||||||
|
/**
|
||||||
|
* 在组件在视图层布局完成后执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
ready(): void
|
||||||
|
/**
|
||||||
|
* 在组件实例被移动到节点树另一个位置时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
moved(): void
|
||||||
|
/**
|
||||||
|
* 在组件实例被从页面节点树移除时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
detached(): void
|
||||||
|
/**
|
||||||
|
* 每当组件方法抛出错误时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
error(err: Error): void
|
||||||
|
}>
|
||||||
|
/**
|
||||||
|
* @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义
|
||||||
|
*
|
||||||
|
* 在组件实例刚刚被创建时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
created(): void
|
||||||
|
/**
|
||||||
|
* @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义
|
||||||
|
*
|
||||||
|
* 在组件实例进入页面节点树时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
attached(): void
|
||||||
|
/**
|
||||||
|
* @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义
|
||||||
|
*
|
||||||
|
* 在组件在视图层布局完成后执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
ready(): void
|
||||||
|
/**
|
||||||
|
* @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义
|
||||||
|
*
|
||||||
|
* 在组件实例被移动到节点树另一个位置时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
moved(): void
|
||||||
|
/**
|
||||||
|
* @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义
|
||||||
|
*
|
||||||
|
* 在组件实例被从页面节点树移除时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`1.6.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
detached(): void
|
||||||
|
/**
|
||||||
|
* @deprecated 旧式的定义方式,基础库 `2.2.3` 起请在 lifetimes 中定义
|
||||||
|
*
|
||||||
|
* 每当组件方法抛出错误时执行
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.4.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
error(err: Error): void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface OtherOption {
|
||||||
|
/** 类似于mixins和traits的组件间代码复用机制,参见 [behaviors](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/behaviors.html) */
|
||||||
|
behaviors: Behavior.BehaviorIdentifier[]
|
||||||
|
/**
|
||||||
|
* 组件数据字段监听器,用于监听 properties 和 data 的变化,参见 [数据监听器](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/observer.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本:[`2.6.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||||
|
*/
|
||||||
|
observers: Record<string, (...args: any[]) => any>
|
||||||
|
/** 组件间关系定义,参见 [组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html) */
|
||||||
|
relations: {
|
||||||
|
[componentName: string]: RelationOption
|
||||||
|
}
|
||||||
|
/** 组件接受的外部样式类,参见 [外部样式类](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html) */
|
||||||
|
externalClasses?: string[]
|
||||||
|
/** 组件所在页面的生命周期声明对象,参见 [组件生命周期](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/lifetimes.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */
|
||||||
|
pageLifetimes?: Partial<PageLifetimes>
|
||||||
|
/** 一些选项(文档中介绍相关特性时会涉及具体的选项设置,这里暂不列举) */
|
||||||
|
options: ComponentOptions
|
||||||
|
|
||||||
|
/** 定义段过滤器,用于自定义组件扩展,参见 [自定义组件扩展](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/extend.html)
|
||||||
|
*
|
||||||
|
* 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */
|
||||||
|
definitionFilter?: DefinitionFilter
|
||||||
|
/**
|
||||||
|
* 组件自定义导出,当使用 `behavior: wx://component-export` 时,这个定义段可以用于指定组件被 selectComponent 调用时的返回值,参见 [组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html)
|
||||||
|
* 最低基础库版本: [`2.2.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) */
|
||||||
|
export: () => IAnyObject
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KeyFrame {
|
||||||
|
/** 关键帧的偏移,范围[0-1] */
|
||||||
|
offset?: number
|
||||||
|
/** 动画缓动函数 */
|
||||||
|
ease?: string
|
||||||
|
/** 基点位置,即 CSS transform-origin */
|
||||||
|
transformOrigin?: string
|
||||||
|
/** 背景颜色,即 CSS background-color */
|
||||||
|
backgroundColor?: string
|
||||||
|
/** 底边位置,即 CSS bottom */
|
||||||
|
bottom?: number | string
|
||||||
|
/** 高度,即 CSS height */
|
||||||
|
height?: number | string
|
||||||
|
/** 左边位置,即 CSS left */
|
||||||
|
left?: number | string
|
||||||
|
/** 宽度,即 CSS width */
|
||||||
|
width?: number | string
|
||||||
|
/** 不透明度,即 CSS opacity */
|
||||||
|
opacity?: number | string
|
||||||
|
/** 右边位置,即 CSS right */
|
||||||
|
right?: number | string
|
||||||
|
/** 顶边位置,即 CSS top */
|
||||||
|
top?: number | string
|
||||||
|
/** 变换矩阵,即 CSS transform matrix */
|
||||||
|
matrix?: number[]
|
||||||
|
/** 三维变换矩阵,即 CSS transform matrix3d */
|
||||||
|
matrix3d?: number[]
|
||||||
|
/** 旋转,即 CSS transform rotate */
|
||||||
|
rotate?: number
|
||||||
|
/** 三维旋转,即 CSS transform rotate3d */
|
||||||
|
rotate3d?: number[]
|
||||||
|
/** X 方向旋转,即 CSS transform rotateX */
|
||||||
|
rotateX?: number
|
||||||
|
/** Y 方向旋转,即 CSS transform rotateY */
|
||||||
|
rotateY?: number
|
||||||
|
/** Z 方向旋转,即 CSS transform rotateZ */
|
||||||
|
rotateZ?: number
|
||||||
|
/** 缩放,即 CSS transform scale */
|
||||||
|
scale?: number[]
|
||||||
|
/** 三维缩放,即 CSS transform scale3d */
|
||||||
|
scale3d?: number[]
|
||||||
|
/** X 方向缩放,即 CSS transform scaleX */
|
||||||
|
scaleX?: number
|
||||||
|
/** Y 方向缩放,即 CSS transform scaleY */
|
||||||
|
scaleY?: number
|
||||||
|
/** Z 方向缩放,即 CSS transform scaleZ */
|
||||||
|
scaleZ?: number
|
||||||
|
/** 倾斜,即 CSS transform skew */
|
||||||
|
skew?: number[]
|
||||||
|
/** X 方向倾斜,即 CSS transform skewX */
|
||||||
|
skewX?: number
|
||||||
|
/** Y 方向倾斜,即 CSS transform skewY */
|
||||||
|
skewY?: number
|
||||||
|
/** 位移,即 CSS transform translate */
|
||||||
|
translate?: Array<number | string>
|
||||||
|
/** 三维位移,即 CSS transform translate3d */
|
||||||
|
translate3d?: Array<number | string>
|
||||||
|
/** X 方向位移,即 CSS transform translateX */
|
||||||
|
translateX?: number | string
|
||||||
|
/** Y 方向位移,即 CSS transform translateY */
|
||||||
|
translateY?: number | string
|
||||||
|
/** Z 方向位移,即 CSS transform translateZ */
|
||||||
|
translateZ?: number | string
|
||||||
|
}
|
||||||
|
interface ClearAnimationOptions {
|
||||||
|
/** 基点位置,即 CSS transform-origin */
|
||||||
|
transformOrigin?: boolean
|
||||||
|
/** 背景颜色,即 CSS background-color */
|
||||||
|
backgroundColor?: boolean
|
||||||
|
/** 底边位置,即 CSS bottom */
|
||||||
|
bottom?: boolean
|
||||||
|
/** 高度,即 CSS height */
|
||||||
|
height?: boolean
|
||||||
|
/** 左边位置,即 CSS left */
|
||||||
|
left?: boolean
|
||||||
|
/** 宽度,即 CSS width */
|
||||||
|
width?: boolean
|
||||||
|
/** 不透明度,即 CSS opacity */
|
||||||
|
opacity?: boolean
|
||||||
|
/** 右边位置,即 CSS right */
|
||||||
|
right?: boolean
|
||||||
|
/** 顶边位置,即 CSS top */
|
||||||
|
top?: boolean
|
||||||
|
/** 变换矩阵,即 CSS transform matrix */
|
||||||
|
matrix?: boolean
|
||||||
|
/** 三维变换矩阵,即 CSS transform matrix3d */
|
||||||
|
matrix3d?: boolean
|
||||||
|
/** 旋转,即 CSS transform rotate */
|
||||||
|
rotate?: boolean
|
||||||
|
/** 三维旋转,即 CSS transform rotate3d */
|
||||||
|
rotate3d?: boolean
|
||||||
|
/** X 方向旋转,即 CSS transform rotateX */
|
||||||
|
rotateX?: boolean
|
||||||
|
/** Y 方向旋转,即 CSS transform rotateY */
|
||||||
|
rotateY?: boolean
|
||||||
|
/** Z 方向旋转,即 CSS transform rotateZ */
|
||||||
|
rotateZ?: boolean
|
||||||
|
/** 缩放,即 CSS transform scale */
|
||||||
|
scale?: boolean
|
||||||
|
/** 三维缩放,即 CSS transform scale3d */
|
||||||
|
scale3d?: boolean
|
||||||
|
/** X 方向缩放,即 CSS transform scaleX */
|
||||||
|
scaleX?: boolean
|
||||||
|
/** Y 方向缩放,即 CSS transform scaleY */
|
||||||
|
scaleY?: boolean
|
||||||
|
/** Z 方向缩放,即 CSS transform scaleZ */
|
||||||
|
scaleZ?: boolean
|
||||||
|
/** 倾斜,即 CSS transform skew */
|
||||||
|
skew?: boolean
|
||||||
|
/** X 方向倾斜,即 CSS transform skewX */
|
||||||
|
skewX?: boolean
|
||||||
|
/** Y 方向倾斜,即 CSS transform skewY */
|
||||||
|
skewY?: boolean
|
||||||
|
/** 位移,即 CSS transform translate */
|
||||||
|
translate?: boolean
|
||||||
|
/** 三维位移,即 CSS transform translate3d */
|
||||||
|
translate3d?: boolean
|
||||||
|
/** X 方向位移,即 CSS transform translateX */
|
||||||
|
translateX?: boolean
|
||||||
|
/** Y 方向位移,即 CSS transform translateY */
|
||||||
|
translateY?: boolean
|
||||||
|
/** Z 方向位移,即 CSS transform translateZ */
|
||||||
|
translateZ?: boolean
|
||||||
|
}
|
||||||
|
interface ScrollTimelineKeyframe {
|
||||||
|
composite?: 'replace' | 'add' | 'accumulate' | 'auto'
|
||||||
|
easing?: string
|
||||||
|
offset?: number | null
|
||||||
|
[property: string]: string | number | null | undefined
|
||||||
|
}
|
||||||
|
interface ScrollTimelineOption {
|
||||||
|
/** 指定滚动元素的选择器(只支持 scroll-view),该元素滚动时会驱动动画的进度 */
|
||||||
|
scrollSource: string
|
||||||
|
/** 指定滚动的方向。有效值为 horizontal 或 vertical */
|
||||||
|
orientation?: string
|
||||||
|
/** 指定开始驱动动画进度的滚动偏移量,单位 px */
|
||||||
|
startScrollOffset: number
|
||||||
|
/** 指定停止驱动动画进度的滚动偏移量,单位 px */
|
||||||
|
endScrollOffset: number
|
||||||
|
/** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */
|
||||||
|
timeRange: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface SetUpdatePerformanceListenerOption<WithDataPath> {
|
||||||
|
/** 是否返回变更的 data 字段信息 */
|
||||||
|
withDataPaths?: WithDataPath
|
||||||
|
}
|
||||||
|
interface UpdatePerformanceListener<WithDataPath> {
|
||||||
|
(res: UpdatePerformance<WithDataPath>): void
|
||||||
|
}
|
||||||
|
interface UpdatePerformance<WithDataPath> {
|
||||||
|
/** 此次更新过程的 ID */
|
||||||
|
updateProcessId: number
|
||||||
|
/** 对于子更新,返回它所属的更新过程 ID */
|
||||||
|
parentUpdateProcessId?: number
|
||||||
|
/** 是否是被合并更新,如果是,则 updateProcessId 表示被合并到的更新过程 ID */
|
||||||
|
isMergedUpdate: boolean
|
||||||
|
/** 此次更新的 data 字段信息,只有 withDataPaths 设为 true 时才会返回 */
|
||||||
|
dataPaths: WithDataPath extends true ? string[] : undefined
|
||||||
|
/** 此次更新进入等待队列时的时间戳 */
|
||||||
|
pendingStartTimestamp: number
|
||||||
|
/** 更新运算开始时的时间戳 */
|
||||||
|
updateStartTimestamp: number
|
||||||
|
/** 更新运算结束时的时间戳 */
|
||||||
|
updateEndTimestamp: number
|
||||||
|
}
|
||||||
|
|
||||||
|
type PassiveConfig =
|
||||||
|
| {
|
||||||
|
/** 是否设置 touchmove 事件为 passive,默认为 `false` */
|
||||||
|
touchmove?: boolean
|
||||||
|
/** 是否设置 touchstart 事件为 passive,默认为 `false` */
|
||||||
|
touchstart?: boolean
|
||||||
|
/** 是否设置 wheel 事件为 passive,默认为 `false` */
|
||||||
|
wheel?: boolean
|
||||||
|
}
|
||||||
|
| boolean
|
||||||
|
}
|
||||||
|
/** Component构造器可用于定义组件,调用Component构造器时可以指定组件的属性、数据、方法等。
|
||||||
|
*
|
||||||
|
* * 使用 `this.data` 可以获取内部数据和属性值,但不要直接修改它们,应使用 `setData` 修改。
|
||||||
|
* * 生命周期函数无法在组件方法中通过 `this` 访问到。
|
||||||
|
* * 属性名应避免以 data 开头,即不要命名成 `dataXyz` 这样的形式,因为在 WXML 中, `data-xyz=""` 会被作为节点 dataset 来处理,而不是组件属性。
|
||||||
|
* * 在一个组件的定义和使用时,组件的属性名和 data 字段相互间都不能冲突(尽管它们位于不同的定义段中)。
|
||||||
|
* * 从基础库 `2.0.9` 开始,对象类型的属性和 data 字段中可以包含函数类型的子字段,即可以通过对象类型的属性字段来传递函数。低于这一版本的基础库不支持这一特性。
|
||||||
|
* * `bug` : 对于 type 为 Object 或 Array 的属性,如果通过该组件自身的 `this.setData` 来改变属性值的一个子字段,则依旧会触发属性 observer ,且 observer 接收到的 `newVal` 是变化的那个子字段的值, `oldVal` 为空, `changedPath` 包含子字段的字段名相关信息。
|
||||||
|
*/
|
||||||
|
declare let Component: WechatMiniprogram.Component.Constructor
|
||||||
@@ -0,0 +1,272 @@
|
|||||||
|
/*! *****************************************************************************
|
||||||
|
Copyright (c) 2023 Tencent, Inc. All rights reserved.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
this software and associated documentation files (the "Software"), to deal in
|
||||||
|
the Software without restriction, including without limitation the rights to
|
||||||
|
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
***************************************************************************** */
|
||||||
|
|
||||||
|
declare namespace WechatMiniprogram.Page {
|
||||||
|
type Instance<
|
||||||
|
TData extends DataOption,
|
||||||
|
TCustom extends CustomOption
|
||||||
|
> = OptionalInterface<ILifetime> &
|
||||||
|
InstanceProperties &
|
||||||
|
InstanceMethods<TData> &
|
||||||
|
Data<TData> &
|
||||||
|
TCustom
|
||||||
|
type Options<
|
||||||
|
TData extends DataOption,
|
||||||
|
TCustom extends CustomOption
|
||||||
|
> = (TCustom &
|
||||||
|
Partial<Data<TData>> &
|
||||||
|
Partial<ILifetime> & {
|
||||||
|
options?: Component.ComponentOptions
|
||||||
|
}) &
|
||||||
|
ThisType<Instance<TData, TCustom>>
|
||||||
|
type TrivialInstance = Instance<IAnyObject, IAnyObject>
|
||||||
|
interface Constructor {
|
||||||
|
<TData extends DataOption, TCustom extends CustomOption>(
|
||||||
|
options: Options<TData, TCustom>
|
||||||
|
): void
|
||||||
|
}
|
||||||
|
interface ILifetime {
|
||||||
|
/** 生命周期回调—监听页面加载
|
||||||
|
*
|
||||||
|
* 页面加载时触发。一个页面只会调用一次,可以在 onLoad 的参数中获取打开当前页面路径中的参数。
|
||||||
|
*/
|
||||||
|
onLoad(
|
||||||
|
/** 打开当前页面路径中的参数 */
|
||||||
|
query: Record<string, string | undefined>
|
||||||
|
): void | Promise<void>
|
||||||
|
/** 生命周期回调—监听页面显示
|
||||||
|
*
|
||||||
|
* 页面显示/切入前台时触发。
|
||||||
|
*/
|
||||||
|
onShow(): void | Promise<void>
|
||||||
|
/** 生命周期回调—监听页面初次渲染完成
|
||||||
|
*
|
||||||
|
* 页面初次渲染完成时触发。一个页面只会调用一次,代表页面已经准备妥当,可以和视图层进行交互。
|
||||||
|
*
|
||||||
|
|
||||||
|
* 注意:对界面内容进行设置的 API 如`wx.setNavigationBarTitle`,请在`onReady`之后进行。
|
||||||
|
*/
|
||||||
|
onReady(): void | Promise<void>
|
||||||
|
/** 生命周期回调—监听页面隐藏
|
||||||
|
*
|
||||||
|
* 页面隐藏/切入后台时触发。 如 `navigateTo` 或底部 `tab` 切换到其他页面,小程序切入后台等。
|
||||||
|
*/
|
||||||
|
onHide(): void | Promise<void>
|
||||||
|
/** 生命周期回调—监听页面卸载
|
||||||
|
*
|
||||||
|
* 页面卸载时触发。如`redirectTo`或`navigateBack`到其他页面时。
|
||||||
|
*/
|
||||||
|
onUnload(): void | Promise<void>
|
||||||
|
/** 监听用户下拉动作
|
||||||
|
*
|
||||||
|
* 监听用户下拉刷新事件。
|
||||||
|
* - 需要在`app.json`的`window`选项中或页面配置中开启`enablePullDownRefresh`。
|
||||||
|
* - 可以通过`wx.startPullDownRefresh`触发下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
|
||||||
|
* - 当处理完数据刷新后,`wx.stopPullDownRefresh`可以停止当前页面的下拉刷新。
|
||||||
|
*/
|
||||||
|
onPullDownRefresh(): void | Promise<void>
|
||||||
|
/** 页面上拉触底事件的处理函数
|
||||||
|
*
|
||||||
|
* 监听用户上拉触底事件。
|
||||||
|
* - 可以在`app.json`的`window`选项中或页面配置中设置触发距离`onReachBottomDistance`。
|
||||||
|
* - 在触发距离内滑动期间,本事件只会被触发一次。
|
||||||
|
*/
|
||||||
|
onReachBottom(): void | Promise<void>
|
||||||
|
/** 用户点击右上角转发
|
||||||
|
*
|
||||||
|
* 监听用户点击页面内转发按钮(`<button>` 组件 `open-type="share"`)或右上角菜单“转发”按钮的行为,并自定义转发内容。
|
||||||
|
*
|
||||||
|
* **注意:只有定义了此事件处理函数,右上角菜单才会显示“转发”按钮**
|
||||||
|
*
|
||||||
|
* 此事件需要 return 一个 Object,用于自定义转发内容
|
||||||
|
*/
|
||||||
|
onShareAppMessage(
|
||||||
|
/** 分享发起来源参数 */
|
||||||
|
options: IShareAppMessageOption
|
||||||
|
):
|
||||||
|
| ICustomShareContent
|
||||||
|
| IAsyncCustomShareContent
|
||||||
|
| Promise<ICustomShareContent>
|
||||||
|
| void
|
||||||
|
| Promise<void>
|
||||||
|
/**
|
||||||
|
* 监听右上角菜单“分享到朋友圈”按钮的行为,并自定义分享内容
|
||||||
|
*
|
||||||
|
* 本接口为 Beta 版本,暂只在 Android 平台支持,详见 [分享到朋友圈 (Beta)](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share-timeline.html)
|
||||||
|
*
|
||||||
|
* 基础库 2.11.3 开始支持,低版本需做兼容处理。
|
||||||
|
*/
|
||||||
|
onShareTimeline(): ICustomTimelineContent | void
|
||||||
|
|
||||||
|
/** 页面滚动触发事件的处理函数
|
||||||
|
*
|
||||||
|
* 监听用户滑动页面事件。
|
||||||
|
*/
|
||||||
|
onPageScroll(
|
||||||
|
/** 页面滚动参数 */
|
||||||
|
options: IPageScrollOption
|
||||||
|
): void | Promise<void>
|
||||||
|
|
||||||
|
/** 当前是 tab 页时,点击 tab 时触发,最低基础库: `1.9.0` */
|
||||||
|
onTabItemTap(
|
||||||
|
/** tab 点击参数 */
|
||||||
|
options: ITabItemTapOption
|
||||||
|
): void | Promise<void>
|
||||||
|
|
||||||
|
/** 窗口尺寸改变时触发,最低基础库:`2.4.0` */
|
||||||
|
onResize(
|
||||||
|
/** 窗口尺寸参数 */
|
||||||
|
options: IResizeOption
|
||||||
|
): void | Promise<void>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听用户点击右上角菜单“收藏”按钮的行为,并自定义收藏内容。
|
||||||
|
* 基础库 2.10.3,安卓 7.0.15 版本起支持,iOS 暂不支持
|
||||||
|
*/
|
||||||
|
onAddToFavorites(options: IAddToFavoritesOption): IAddToFavoritesContent
|
||||||
|
}
|
||||||
|
interface InstanceProperties {
|
||||||
|
/** 页面的文件路径 */
|
||||||
|
is: string
|
||||||
|
|
||||||
|
/** 到当前页面的路径 */
|
||||||
|
route: string
|
||||||
|
|
||||||
|
/** 打开当前页面路径中的参数 */
|
||||||
|
options: Record<string, string | undefined>
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataOption = Record<string, any>
|
||||||
|
type CustomOption = Record<string, any>
|
||||||
|
|
||||||
|
type InstanceMethods<D extends DataOption> = Component.InstanceMethods<D>
|
||||||
|
|
||||||
|
interface Data<D extends DataOption> {
|
||||||
|
/** 页面的初始数据
|
||||||
|
*
|
||||||
|
* `data` 是页面第一次渲染使用的**初始数据**。
|
||||||
|
*
|
||||||
|
* 页面加载时,`data` 将会以`JSON`字符串的形式由逻辑层传至渲染层,因此`data`中的数据必须是可以转成`JSON`的类型:字符串,数字,布尔值,对象,数组。
|
||||||
|
*
|
||||||
|
* 渲染层可以通过 `WXML` 对数据进行绑定。
|
||||||
|
*/
|
||||||
|
data: D
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICustomShareContent {
|
||||||
|
/** 转发标题。默认值:当前小程序名称 */
|
||||||
|
title?: string
|
||||||
|
/** 转发路径,必须是以 / 开头的完整路径。默认值:当前页面 path */
|
||||||
|
path?: string
|
||||||
|
/** 自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径。支持PNG及JPG。显示图片长宽比是 5:4,最低基础库: `1.5.0`。默认值:使用默认截图 */
|
||||||
|
imageUrl?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAsyncCustomShareContent extends ICustomShareContent {
|
||||||
|
promise: Promise<ICustomShareContent>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ICustomTimelineContent {
|
||||||
|
/** 自定义标题,即朋友圈列表页上显示的标题。默认值:当前小程序名称 */
|
||||||
|
title?: string
|
||||||
|
/** 自定义页面路径中携带的参数,如 `path?a=1&b=2` 的 “?” 后面部分 默认值:当前页面路径携带的参数 */
|
||||||
|
query?: string
|
||||||
|
/** 自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径。支持 PNG 及 JPG。显示图片长宽比是 1:1。默认值:默认使用小程序 Logo*/
|
||||||
|
imageUrl?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IPageScrollOption {
|
||||||
|
/** 页面在垂直方向已滚动的距离(单位px) */
|
||||||
|
scrollTop: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IShareAppMessageOption {
|
||||||
|
/** 转发事件来源。
|
||||||
|
*
|
||||||
|
* 可选值:
|
||||||
|
* - `button`:页面内转发按钮;
|
||||||
|
* - `menu`:右上角转发菜单。
|
||||||
|
*
|
||||||
|
* 最低基础库: `1.2.4`
|
||||||
|
*/
|
||||||
|
from: 'button' | 'menu'
|
||||||
|
/** 如果 `from` 值是 `button`,则 `target` 是触发这次转发事件的 `button`,否则为 `undefined`
|
||||||
|
*
|
||||||
|
* 最低基础库: `1.2.4` */
|
||||||
|
target: any
|
||||||
|
/** 页面中包含`<web-view>`组件时,返回当前`<web-view>`的url
|
||||||
|
*
|
||||||
|
* 最低基础库: `1.6.4`
|
||||||
|
*/
|
||||||
|
webViewUrl?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ITabItemTapOption {
|
||||||
|
/** 被点击tabItem的序号,从0开始,最低基础库: `1.9.0` */
|
||||||
|
index: string
|
||||||
|
/** 被点击tabItem的页面路径,最低基础库: `1.9.0` */
|
||||||
|
pagePath: string
|
||||||
|
/** 被点击tabItem的按钮文字,最低基础库: `1.9.0` */
|
||||||
|
text: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IResizeOption {
|
||||||
|
size: {
|
||||||
|
/** 变化后的窗口宽度,单位 px */
|
||||||
|
windowWidth: number
|
||||||
|
/** 变化后的窗口高度,单位 px */
|
||||||
|
windowHeight: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAddToFavoritesOption {
|
||||||
|
/** 页面中包含web-view组件时,返回当前web-view的url */
|
||||||
|
webviewUrl?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface IAddToFavoritesContent {
|
||||||
|
/** 自定义标题,默认值:页面标题或账号名称 */
|
||||||
|
title?: string
|
||||||
|
/** 自定义图片,显示图片长宽比为 1:1,默认值:页面截图 */
|
||||||
|
imageUrl?: string
|
||||||
|
/** 自定义query字段,默认值:当前页面的query */
|
||||||
|
query?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetCurrentPages {
|
||||||
|
(): Array<Instance<IAnyObject, IAnyObject>>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册小程序中的一个页面。接受一个 `Object` 类型参数,其指定页面的初始数据、生命周期回调、事件处理函数等。
|
||||||
|
*/
|
||||||
|
declare let Page: WechatMiniprogram.Page.Constructor
|
||||||
|
/**
|
||||||
|
* 获取当前页面栈。数组中第一个元素为首页,最后一个元素为当前页面。
|
||||||
|
|
||||||
|
* __注意:__
|
||||||
|
|
||||||
|
* - __不要尝试修改页面栈,会导致路由以及页面状态错误。__
|
||||||
|
* - 不要在 `App.onLaunch` 的时候调用 `getCurrentPages()`,此时 `page` 还没有生成。
|
||||||
|
*/
|
||||||
|
declare let getCurrentPages: WechatMiniprogram.Page.GetCurrentPages
|
||||||