当前位置:网站首页>微信小程序中 在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
}
边栏推荐
- Uniapp uses canvas to generate posters and save them locally
- 数据传输中的成帧
- 汇率的查询接口
- 在QML中加载不同字体
- Qualcomm platform WiFi -- Native crash caused by WiFi
- West digital decided to raise the price of flash memory products immediately after the factory was polluted by materials
- Custom classloader that breaks parental delegation
- Discrimination between sap Hana, s/4hana and SAP BTP
- 竞争与冒险 毛刺
- 2022 hoisting machinery command examination paper and summary of hoisting machinery command examination
猜你喜欢
Review materials of project management PMP high frequency examination sites (8-1)
OSPF LSA message parsing (under update)
Knowing things by learning | self supervised learning helps improve the effect of content risk control
命名块 verilog
"Analysis of 43 cases of MATLAB neural network": Chapter 41 implementation of customized neural network -- personalized modeling and Simulation of neural network
Verilog 时序控制
Learn PWN from CTF wiki - ret2shellcode
Halcon image rectification
Verilog 过程连续赋值
How to establish its own NFT market platform in 2022
随机推荐
JS introduction < 1 >
JIT deep analysis
流线线使用阻塞还是非阻塞
MSI announced that its motherboard products will cancel all paper accessories
MySQL connection query and subquery
Detailed explanation of ThreadLocal
Global and Chinese market of bone adhesives 2022-2028: Research Report on technology, participants, trends, market size and share
Custom classloader that breaks parental delegation
SAML2.0 笔记(一)
Getting started with MQ
32, 64, 128 bit system
Cache processing scheme in high concurrency scenario
In depth analysis of C language - variable error prone knowledge points # dry goods inventory #
Verilog 过程连续赋值
SAML2.0 notes (I)
FFMpeg AVFrame 的概念.
Design details of SAP e-commerce cloud footernavigationcomponent
Kubernetes cluster storageclass persistent storage resource core concept and use
竞争与冒险 毛刺
《MATLAB 神经网络43个案例分析》:第41章 定制神经网络的实现——神经网络的个性化建模与仿真