Skip to content

Commit

Permalink
chore: wxs this change to _this (#3488)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmywang authored Feb 17, 2025
1 parent e4f94ec commit af5abc4
Show file tree
Hide file tree
Showing 24 changed files with 70 additions and 70 deletions.
2 changes: 1 addition & 1 deletion src/action-sheet/action-sheet.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="./action-sheet.wxs" module="this" />
<wxs src="./action-sheet.wxs" module="_this" />
<wxs src="../common/utils.wxs" module="_" />
<import src="./template/list.wxml" />
<import src="./template/grid.wxml" />
Expand Down
8 changes: 4 additions & 4 deletions src/avatar/avatar.wxml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<import src="../common/template/icon.wxml" />
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./avatar.wxs" module="this" />
<wxs src="./avatar.wxs" module="_this" />

<view
class="{{classPrefix}}__wrapper class {{prefix}}-class"
style="{{_._style([this.getStyles(isShow), style, customStyle])}}"
style="{{_._style([_this.getStyles(isShow), style, customStyle])}}"
>
<t-badge
color="{{badgeProps.color || ''}}"
Expand All @@ -21,8 +21,8 @@
t-class-count="{{badgeProps.tClassCount}}"
>
<view
class="{{this.getClass(classPrefix, size || 'medium', shape, bordered)}} {{prefix}}-class-image"
style="{{this.getSize(size, systemInfo)}}"
class="{{_this.getClass(classPrefix, size || 'medium', shape, bordered)}} {{prefix}}-class-image"
style="{{_this.getSize(size, systemInfo)}}"
aria-label="{{ ariaLabel || alt ||'头像'}}"
aria-role="{{ ariaRole || 'img'}}"
aria-hidden="{{ ariaHidden }}"
Expand Down
12 changes: 6 additions & 6 deletions src/badge/badge.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="./badge.wxs" module="this" />
<wxs src="./badge.wxs" module="_this" />
<wxs src="../common/utils.wxs" module="_" />

<!--
Expand All @@ -9,7 +9,7 @@

<view
style="{{_._style([style, customStyle])}}"
class="{{this.getBadgeOuterClass({shape})}} class {{prefix}}-class"
class="{{_this.getBadgeOuterClass({shape})}} class {{prefix}}-class"
aria-labelledby="{{labelID}}"
aria-describedby="{{descriptionID}}"
aria-role="{{ ariaRole || 'option'}}"
Expand All @@ -21,14 +21,14 @@
<view
aria-hidden="true"
aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}"
wx:if="{{this.isShowBadge({dot,count,showZero})}}"
wx:if="{{_this.isShowBadge({dot,count,showZero})}}"
id="{{descriptionID}}"
class="{{this.getBadgeInnerClass({dot, size, shape, count})}} {{prefix}}-has-count {{prefix}}-class-count"
style="{{_._style([this.getBadgeStyles({color, offset})])}}"
class="{{_this.getBadgeInnerClass({dot, size, shape, count})}} {{prefix}}-has-count {{prefix}}-class-count"
style="{{_._style([_this.getBadgeStyles({color, offset})])}}"
aria-hidden="true"
aria-label="{{ ariaLabel || _.getBadgeAriaLabel({dot, count, maxCount}) }}"
>
{{ this.getBadgeValue({dot, count, maxCount}) }}
{{ _this.getBadgeValue({dot, count, maxCount}) }}
</view>
<slot name="count" />
</view>
4 changes: 2 additions & 2 deletions src/calendar/_example/base/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-calendar visible="{{visible}}" value="{{value}}" bind:confirm="handleConfirm" bind:close="onClose" />
<t-cell arrow title="单个选择日历" note="{{this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
<t-cell arrow title="单个选择日历" note="{{_this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
4 changes: 2 additions & 2 deletions src/calendar/_example/custom-range/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-calendar
visible="{{visible}}"
Expand All @@ -7,4 +7,4 @@
maxDate="{{maxDate}}"
bind:confirm="handleConfirm"
/>
<t-cell arrow title="含不可选的日历" note="{{this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
<t-cell arrow title="含不可选的日历" note="{{_this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
6 changes: 3 additions & 3 deletions src/calendar/_example/custom-text/index.wxml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-cell
arrow
title="带单行描述的日历"
note="{{this.formatTimestamp(singleValue)}}"
note="{{_this.formatTimestamp(singleValue)}}"
data-type="single"
bind:tap="handleCalendar"
/>
Expand All @@ -21,7 +21,7 @@
<t-cell
arrow
title="带双行描述的日历"
note="{{this.formatTimestamp(value)}}"
note="{{_this.formatTimestamp(value)}}"
data-type="multiple"
bind:tap="handleCalendar"
/>
4 changes: 2 additions & 2 deletions src/calendar/_example/local-text/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-calendar
visible="{{visible}}"
Expand All @@ -9,4 +9,4 @@
bind:confirm="handleConfirm"
bind:close="onClose"
/>
<t-cell arrow title="国际化" note="{{this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
<t-cell arrow title="国际化" note="{{_this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
4 changes: 2 additions & 2 deletions src/calendar/_example/multiple/index.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-calendar visible="{{visible}}" value="{{value}}" type="multiple" bind:confirm="handleConfirm" />
<t-cell arrow title="多个选择日历" bind:tap="handleCalendar">
<view slot="note" class="custom-class-note"> {{this.formatTimestamp(value)}} </view>
<view slot="note" class="custom-class-note"> {{_this.formatTimestamp(value)}} </view>
</t-cell>
6 changes: 3 additions & 3 deletions src/calendar/_example/range/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-calendar
visible="{{visible}}"
Expand All @@ -10,7 +10,7 @@
/>

<view class="wrapper" bind:tap="handleCalendar">
<view class="wrapper__left">{{this.formatTimestamp(value[0])}}</view>
<view class="wrapper__left">{{_this.formatTimestamp(value[0])}}</view>
<t-icon class="wrapper__center" name="swap-right" size="40rpx" />
<view class="wrapper__right">{{this.formatTimestamp(value[1])}}</view>
<view class="wrapper__right">{{_this.formatTimestamp(value[1])}}</view>
</view>
4 changes: 2 additions & 2 deletions src/calendar/_example/switch-mode/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="../calendar.wxs" module="this" />
<wxs src="../calendar.wxs" module="_this" />

<t-calendar
visible="{{visible}}"
Expand All @@ -9,4 +9,4 @@
bind:confirm="handleConfirm"
bind:panel-change="handlePanelChange"
/>
<t-cell arrow title="带翻页功能的日历" note="{{this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
<t-cell arrow title="带翻页功能的日历" note="{{_this.formatTimestamp(value)}}" bind:tap="handleCalendar" />
2 changes: 1 addition & 1 deletion src/calendar/calendar.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="./calendar.wxs" module="this" />
<wxs src="./calendar.wxs" module="_this" />
<wxs src="../common/utils.wxs" module="_" />

<t-popup
Expand Down
8 changes: 4 additions & 4 deletions src/calendar/template.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<wxs src="./calendar.wxs" module="this" />
<wxs src="./calendar.wxs" module="_this" />
<wxs src="../common/utils.wxs" module="_" />
<import src="../common/template/button.wxml" />
<import src="./calendar-header.wxml" />
Expand All @@ -23,7 +23,7 @@
<template
wx:if="{{switchMode !== 'none'}}"
is="calendar-header"
data="{{ classPrefix: classPrefix + '-header', switchMode, ...actionButtons, title: this.getMonthTitle(currentMonth[0].year, realLocalText.months[currentMonth[0].month], realLocalText.monthTitle)}}"
data="{{ classPrefix: classPrefix + '-header', switchMode, ...actionButtons, title: _this.getMonthTitle(currentMonth[0].year, realLocalText.months[currentMonth[0].month], realLocalText.monthTitle)}}"
/>
<view aria-hidden class="{{classPrefix}}__days">
<view wx:for="{{days}}" wx:key="index" class="{{classPrefix}}__days-item">{{ item }}</view>
Expand All @@ -40,7 +40,7 @@
<template
wx:if="{{switchMode === 'none'}}"
is="calendar-header"
data="{{class: classPrefix + '__month', classPrefix: classPrefix + '-header', tId: 'year_' + item.year + '_month_' + item.month, switchMode, ...actionButtons, title: this.getMonthTitle(item.year, realLocalText.months[item.month], realLocalText.monthTitle) }}"
data="{{class: classPrefix + '__month', classPrefix: classPrefix + '-header', tId: 'year_' + item.year + '_month_' + item.month, switchMode, ...actionButtons, title: _this.getMonthTitle(item.year, realLocalText.months[item.month], realLocalText.monthTitle) }}"
/>
<view class="{{classPrefix}}__dates">
<view wx:for="{{(item.weekdayOfFirstDay - firstDayOfWeek + 7) % 7}}" wx:key="index" />
Expand All @@ -51,7 +51,7 @@
data-month="{{item.month}}"
data-date="{{dateItem}}"
aria-role="button"
aria-label="{{this.getDateLabel(item, dateItem)}}"
aria-label="{{_this.getDateLabel(item, dateItem)}}"
aria-disabled="{{dateItem.type === 'disabled'}}"
bind:tap="handleSelect"
>
Expand Down
4 changes: 2 additions & 2 deletions src/count-down/count-down.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wxs src="../common/utils.wxs" module="_" />
<wxs module="this"> module.exports.format = function(num) { return num < 10 ? '0' + num : num; } </wxs>
<wxs module="_this"> module.exports.format = function(num) { return num < 10 ? '0' + num : num; } </wxs>

<view
style="{{_._style([style, customStyle])}}"
Expand All @@ -11,7 +11,7 @@
<block wx:elif="{{theme == 'default' && !splitWithUnit}}">{{formattedTime}}</block>
<block wx:else>
<block wx:for="{{timeRange}}" wx:key="index">
<text class="{{classPrefix}}__item {{prefix}}-class-count">{{this.format(timeData[timeRange[index]])}}</text>
<text class="{{classPrefix}}__item {{prefix}}-class-count">{{_this.format(timeData[timeRange[index]])}}</text>
<text
wx:if="{{ splitWithUnit || timeRange.length - 1 !== index}}"
class="{{classPrefix}}__split {{classPrefix}}__split--{{splitWithUnit ? 'text' : 'dot'}} {{prefix}}-class-split"
Expand Down
4 changes: 2 additions & 2 deletions src/dialog/dialog.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<import src="../common/template/button.wxml" />
<import src="../common/template/icon.wxml" />
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./dialog.wxs" module="this" />
<wxs src="./dialog.wxs" module="_this" />

<t-popup
name="dialog"
Expand Down Expand Up @@ -40,7 +40,7 @@
<block wx:for="{{actions}}" wx:key="index">
<template
is="button"
data="{{block: true, type: 'action', extra: index, tClass: prefix + '-class-action', rootClass: this.getActionClass(classPrefix, buttonLayout), ...item }}"
data="{{block: true, type: 'action', extra: index, tClass: prefix + '-class-action', rootClass: _this.getActionClass(classPrefix, buttonLayout), ...item }}"
/>
</block>
</block>
Expand Down
4 changes: 2 additions & 2 deletions src/dropdown-item/dropdown-item.wxml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<wxs module="this" src="./index.wxs" />
<wxs module="_this" src="./index.wxs" />
<wxs module="_" src="../common/utils.wxs" />

<view
wx:if="{{wrapperVisible}}"
class="{{classPrefix}} class {{prefix}}-class"
style="{{_._style([this.getStyles(top, zIndex), style, customStyle])}}"
style="{{_._style([_this.getStyles(top, zIndex), style, customStyle])}}"
>
<view
class="{{ classPrefix }}__mask"
Expand Down
4 changes: 2 additions & 2 deletions src/indexes/indexes.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./indexes.wxs" module="this" />
<wxs src="./indexes.wxs" module="_this" />

<view style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class {{prefix}}-class">
<view
Expand All @@ -17,7 +17,7 @@
data-index="{{index}}"
>
<view aria-role="button" aria-label="{{ activeAnchor === item ? '已选中' + item : ''}}">
{{ this.getFirstCharacter(item) }}
{{ _this.getFirstCharacter(item) }}
</view>
<view class="{{classPrefix}}__sidebar-tips" wx:if="{{ showTips && activeAnchor === item }}">
{{ activeAnchor }}
Expand Down
4 changes: 2 additions & 2 deletions src/input/input.wxml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<import src="../common/template/icon.wxml" />
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./input.wxs" module="this" />
<wxs src="./input.wxs" module="_this" />

<view
style="{{_._style([style, customStyle])}}"
Expand All @@ -26,7 +26,7 @@
<view class="{{classPrefix}}__wrap">
<view class="{{classPrefix}}__content {{classPrefix}}--{{status}}">
<input
class="{{this.getInputClass(classPrefix, suffix, align, disabled)}} {{prefix}}-class-input"
class="{{_this.getInputClass(classPrefix, suffix, align, disabled)}} {{prefix}}-class-input"
maxlength="{{allowInputOverMax ? -1 : maxlength}}"
disabled="{{disabled || readonly}}"
placeholder="{{placeholder}}"
Expand Down
4 changes: 2 additions & 2 deletions src/message-item/message-item.wxml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<wxs src="./message-item.wxs" module="this"></wxs>
<wxs src="./message-item.wxs" module="_this"></wxs>
<wxs src="../common/utils.wxs" module="_" />
<import src="../common/template/icon.wxml" />
<block wx:if="{{visible}}">
<view
class="{{classPrefix}} class {{prefix}}-class {{classPrefix}}--{{theme}} {{fadeClass}}"
style="{{_._style([this.getMessageStyles(zIndex, offset, wrapTop), style, customStyle])}}"
style="{{_._style([_this.getMessageStyles(zIndex, offset, wrapTop), style, customStyle])}}"
animation="{{showAnimation}}"
id="{{id || classPrefix}}"
aria-role="alert"
Expand Down
24 changes: 12 additions & 12 deletions src/progress/progress.wxml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<import src="../common/template/icon.wxml" />
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./progress.wxs" module="this" />
<wxs src="./progress.wxs" module="_this" />

<view style="{{_._style([style, customStyle])}}" class="{{classPrefix}} class">
<view
wx:if="{{theme === this.PRO_THEME.LINE}}"
wx:if="{{theme === _this.PRO_THEME.LINE}}"
class="{{classPrefix }}--thin {{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
>
<view
aria-role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="{{computedProgress}}"
aria-label="{{ ariaLabel || (isIOS ? this.getIOSAriaLabel(status) : this.getAndroidAriaLabel(status)) }}"
aria-label="{{ ariaLabel || (isIOS ? _this.getIOSAriaLabel(status) : _this.getAndroidAriaLabel(status)) }}"
aria-live="polite"
class="{{classPrefix }}__bar"
style="height: {{heightBar}}px;border-radius: {{heightBar}}px;background-color: {{bgColorBar}}"
Expand All @@ -25,9 +25,9 @@
<!-- aria-hidden=true 禁用掉额外的聚焦 -->
<view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
<template
wx:if="{{_.includes(this.STATUS, status)}}"
wx:if="{{_.includes(_this.STATUS, status)}}"
is="icon"
data="{{tClass: classPrefix + '__icon', size:'44rpx', name: this.LINE_STATUS_ICON[status]}}"
data="{{tClass: classPrefix + '__icon', size:'44rpx', name: _this.LINE_STATUS_ICON[status]}}"
></template>
<text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
Expand All @@ -39,9 +39,9 @@
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="{{computedProgress}}"
aria-label="{{ ariaLabel || (isIOS ? this.getIOSAriaLabel(status) : this.getAndroidAriaLabel(status)) }}"
aria-label="{{ ariaLabel || (isIOS ? _this.getIOSAriaLabel(status) : _this.getAndroidAriaLabel(status)) }}"
aria-live="polite"
wx:if="{{theme === this.PRO_THEME.PLUMP}}"
wx:if="{{theme === _this.PRO_THEME.PLUMP}}"
class="{{classPrefix}}__bar {{classPrefix}}--plump {{computedProgress > 10 ? classPrefix + '--over-ten': classPrefix + '--under-ten'}} {{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
style="height: {{heightBar}}px;border-radius: {{heightBar}}px;background-color: {{bgColorBar}}"
>
Expand All @@ -65,28 +65,28 @@
</view>

<view
wx:if="{{theme === this.PRO_THEME.CIRCLE}}"
wx:if="{{theme === _this.PRO_THEME.CIRCLE}}"
class="{{classPrefix}}--status--{{status || computedStatus}} {{prefix}}-class"
>
<view
aria-role="progressbar"
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow="{{computedProgress}}"
aria-label="{{ ariaLabel || (isIOS ? this.getIOSAriaLabel(status) : this.getAndroidAriaLabel(status)) }}"
aria-label="{{ ariaLabel || (isIOS ? _this.getIOSAriaLabel(status) : _this.getAndroidAriaLabel(status)) }}"
aria-live="polite"
class="{{classPrefix}}__canvas--circle"
style="background-image: conic-gradient(from var(--td-progress-circle-from), {{colorCircle || this.STATUS_COLOR[status] || 'var(--td-progress-inner-bg-color)'}} {{computedProgress}}%, {{bgColorBar || 'var(--td-progress-track-bg-color)'}} 0%);"
style="background-image: conic-gradient(from var(--td-progress-circle-from), {{colorCircle || _this.STATUS_COLOR[status] || 'var(--td-progress-inner-bg-color)'}} {{computedProgress}}%, {{bgColorBar || 'var(--td-progress-track-bg-color)'}} 0%);"
>
<view
class="{{classPrefix}}__canvas--inner {{prefix}}-class-bar"
style="{{heightBar? '--td-progress-stroke-circle-width:' + heightBar + 'px' : ''}}"
>
<view wx:if="{{label}}" class="{{classPrefix}}__info {{prefix}}-class-label" aria-hidden="{{ true }}">
<template
wx:if="{{_.includes(this.STATUS, status)}}"
wx:if="{{_.includes(_this.STATUS, status)}}"
is="icon"
data="{{tClass: classPrefix + '__icon', size:'96rpx', name: this.CIRCLE_STATUS_ICON[status]}}"
data="{{tClass: classPrefix + '__icon', size:'96rpx', name: _this.CIRCLE_STATUS_ICON[status]}}"
></template>
<text wx:else>{{ _.isString(label)? label: computedProgress + '%' }}</text>
</view>
Expand Down
4 changes: 2 additions & 2 deletions src/search/search.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<wxs src="../common/utils.wxs" module="_" />
<wxs src="./search.wxs" module="this"></wxs>
<wxs src="./search.wxs" module="_this"></wxs>

<view style="{{_._style([style, customStyle])}}" class="class {{classPrefix}} {{prefix}}-class">
<view
Expand Down Expand Up @@ -71,6 +71,6 @@
bind:tap="onSelectResultItem"
aria-role="option"
>
<rich-text slot="title" nodes="{{this.highLight(item, value)}}"></rich-text>
<rich-text slot="title" nodes="{{_this.highLight(item, value)}}"></rich-text>
</t-cell>
</view>
Loading

0 comments on commit af5abc4

Please sign in to comment.