初始化项目, 添加TDesign等包

This commit is contained in:
zhengw
2025-11-28 16:49:36 +08:00
commit 3e53beb7bb
980 changed files with 39201 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
declare const _default: (funcName?: string) => string;
export default _default;

View File

@@ -0,0 +1 @@
import{getCurrentPage}from"../common/utils";const onPageScroll=function(r){const e=getCurrentPage();if(!e)return;const{pageScroller:o}=e;null==o||o.forEach(e=>{"function"==typeof e&&e(r)})};export default(r="onScroll")=>Behavior({attached(){var e;const o=getCurrentPage();if(!o)return;const l=null===(e=this[r])||void 0===e?void 0:e.bind(this);l&&(this._pageScroller=l),Array.isArray(o.pageScroller)?o.pageScroller.push(l):o.pageScroller="function"==typeof o.onPageScroll?[o.onPageScroll.bind(o),l]:[l],o.onPageScroll=onPageScroll},detached(){var r;const e=getCurrentPage();e&&(e.pageScroller=(null===(r=e.pageScroller)||void 0===r?void 0:r.filter(r=>r!==this._pageScroller))||[])}});

View File

@@ -0,0 +1,2 @@
declare const themeChangeBehavior: string;
export default themeChangeBehavior;

View File

@@ -0,0 +1 @@
import{appBaseInfo}from"../common/utils";const themeChangeBehavior=Behavior({data:{theme:"light"},attached(){this._initTheme()},methods:{_initTheme(){const e=this;e.setData({theme:appBaseInfo.theme}),wx.onThemeChange(t=>{e.setData({theme:t.theme})})}}});export default themeChangeBehavior;

View File

@@ -0,0 +1,2 @@
declare const _default: string;
export default _default;

View File

@@ -0,0 +1 @@
const MinDistance=10,getDirection=(t,s)=>t>s&&t>10?"horizontal":s>t&&s>10?"vertical":"";export default Behavior({methods:{resetTouchStatus(){this.direction="",this.deltaX=0,this.deltaY=0,this.offsetX=0,this.offsetY=0},touchStart(t){this.resetTouchStatus();const[s]=t.touches;this.startX=s.clientX,this.startY=s.clientY},touchMove(t){const[s]=t.touches;this.deltaX=s.clientX-this.startX,this.deltaY=s.clientY-this.startY,this.offsetX=Math.abs(this.deltaX),this.offsetY=Math.abs(this.deltaY),this.direction=getDirection(this.offsetX,this.offsetY)}}});

View File

@@ -0,0 +1 @@
export default function transition(): string;

View File

@@ -0,0 +1 @@
import config from"../common/config";const{prefix:prefix}=config;export default function transition(){return Behavior({properties:{visible:{type:Boolean,value:null,observer:"watchVisible"},appear:Boolean,name:{type:String,value:"fade"},durations:{type:Number,optionalTypes:[Array]}},data:{transitionClass:"",transitionDurations:300,className:"",realVisible:!1},created(){this.status="",this.transitionT=0},attached(){this.durations=this.getDurations(),this.data.visible&&this.enter(),this.inited=!0},detached(){clearTimeout(this.transitionT)},methods:{watchVisible(t,i){this.inited&&t!==i&&(t?this.enter():this.leave())},getDurations(){const{durations:t}=this.data;return Array.isArray(t)?t.map(t=>Number(t)):[Number(t),Number(t)]},enter(){const{name:t,transitionDurations:i}=this.data,[e]=this.durations;this.status="entering",this.setData({realVisible:!0,transitionClass:`${prefix}-${t}-enter ${prefix}-${t}-enter-active`}),clearTimeout(this.transitionT),setTimeout(()=>{this.setData({transitionClass:`${prefix}-${t}-enter-active ${prefix}-${t}-enter-to`})},30),this.transitionT="number"==typeof e&&e>0?setTimeout(this.entered.bind(this),e+30):setTimeout("entering"===this.status?this.entered.bind(this):null,i+30)},entered(){this.customDuration=!1,clearTimeout(this.transitionT),this.status="entered",this.setData({transitionClass:""})},leave(){const{name:t,transitionDurations:i}=this.data,[,e]=this.durations;this.status="leaving",this.setData({transitionClass:`${prefix}-${t}-leave ${prefix}-${t}-leave-active`}),clearTimeout(this.transitionT),setTimeout(()=>{this.setData({transitionClass:`${prefix}-${t}-leave-active ${prefix}-${t}-leave-to`})},30),"number"==typeof e&&e>0?(this.customDuration=!0,this.transitionT=setTimeout(this.leaved.bind(this),e+30)):this.transitionT=setTimeout("leaving"===this.status?this.leaved.bind(this):null,i+30)},leaved(){this.customDuration=!1,this.triggerEvent("leaved"),clearTimeout(this.transitionT),this.status="leaved",this.setData({transitionClass:"",realVisible:!1})},onTransitionEnd(){this.customDuration||(clearTimeout(this.transitionT),"entering"===this.status&&this.data.visible?this.entered():"leaving"!==this.status||this.data.visible||this.leaved())}}})}

View File

@@ -0,0 +1,2 @@
declare const useCustomNavbarBehavior: string;
export default useCustomNavbarBehavior;

View File

@@ -0,0 +1 @@
import{systemInfo}from"../common/utils";const useCustomNavbarBehavior=Behavior({properties:{usingCustomNavbar:{type:Boolean,value:!1},customNavbarHeight:{type:Number,value:0}},data:{distanceTop:0},lifetimes:{attached(){this.properties.usingCustomNavbar&&this.calculateCustomNavbarDistanceTop()}},methods:{calculateCustomNavbarDistanceTop(){const{statusBarHeight:t}=systemInfo,a=wx.getMenuButtonBoundingClientRect(),e=a.top+a.bottom-t;this.setData({distanceTop:Math.max(e,this.properties.customNavbarHeight+t)})}}});export default useCustomNavbarBehavior;