当前位置:网站首页>微信小程序中 在xwml 中使用外部引入的 js进行判断计算
微信小程序中 在xwml 中使用外部引入的 js进行判断计算
2022-07-02 03:25:00 【今天星期八】
使用 场景
- 同一个页面展示两个数组,在js 中计算数组长度麻烦
- 可在wxml中进行操作
在wxml 中使用 (将其在wxml 文件中引入)

<view class="item-info">
<view class="item-title">业主审核</view>
<wxs src="../../utils/calculate.wxs" module="tools" />
<view class="wait" wx:if="{
{tools.calculate(new_list,new_list_gs)>0}}">待审核: {
{
tools.calculate(new_list,new_list_gs)}}</view>
</view>
创建 后缀为 wxs 的文件
function calculate(str1, str2) {
if (str1) {
return str1.length + str2.length
} else {
return '0'
}
}
module.exports = {
calculate: calculate
}
边栏推荐
- Yan Rong looks at how to formulate a multi cloud strategy in the era of hybrid cloud
- Competition and adventure burr
- PMP personal sprint preparation experience
- PY3, PIP appears when installing the library, warning: ignoring invalid distribution -ip
- ThreadLocal详解
- 流线线使用阻塞还是非阻塞
- Sentry experience and architecture, a fledgling monitoring product with a market value of $100million
- 焱融看 | 混合云时代下,如何制定多云策略
- Find duplicates [Abstract binary / fast and slow pointer / binary enumeration]
- Qualcomm platform WiFi -- Native crash caused by WiFi
猜你喜欢

Learn PWN from CTF wiki - ret2shellcode

命名块 verilog

Pointer array & array pointer

高并发场景下缓存处理方案

JS <2>

Download and use of the super perfect screenshot tool snipaste

Generate random numbers that obey normal distribution

Verilog 过程赋值 区别 详解

Comment élaborer une stratégie nuageuse à l'ère des nuages mixtes

MSI announced that its motherboard products will cancel all paper accessories
随机推荐
GSE104154_scRNA-seq_fibrotic MC_bleomycin/normalized AM3
OSPF LSA message parsing (under update)
Design details of SAP e-commerce cloud footernavigationcomponent
Verilog 过程连续赋值
Verilog avoid latch
Xiaomi, a young engineer, was just going to make soy sauce
C # joint halcon out of halcon Environment and various Error Reporting and Resolution Experiences
< job search> process and signal
Aaaaaaaaaaaa
What is the binding path of SAP ui5
Gradle notes
JS <2>
Verilog 状态机
Global and Chinese markets for infant care equipment, 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese markets for hand hygiene monitoring systems 2022-2028: Research Report on technology, participants, trends, market size and share
Kotlin基础学习 17
3124. Word list
Halcon image rectification
"Analysis of 43 cases of MATLAB neural network": Chapter 41 implementation of customized neural network -- personalized modeling and Simulation of neural network
Gradle foundation | customize the plug-in and upload it to jitpack