v-if和v-else和vue-filter过滤器结合实现的条件判断改变样式的功能
<div class="triage-doc">
<template v-if="item.docName.length > 5">
<a-tag color="purple" style="font-size: 15px;">
<a-tooltip>
<template slot="title">
<span>{{item.docName}}</span>
</template>
{{item.docName.substring(0,2)}}...
</a-tooltip>
</a-tag>
</template>
<template v-else>
{{item.docName}}
</template>
<span style="margin-left: 5px;">医生</span>
</div>
public static void main(String[] args) {
int prefix=0;
int endfix=0;
String string="peter piper picked a peck of pickled peppers";
String[] arrStr = string.split(" ");
for(int i=0;i<arrStr.length;i++){
if(arrStr[i].startsWith("p")){prefix++;}
if (arrStr[i].endsWith("r")) {endfix++;} }
System.out.println("以p为开头的字符串个数为"+prefix+"以r为结尾的字符串个数为"+endfix); }
vue前端报错常用命令 清除缓存命令 重新打包
第一种,最常用的一种: 直接删除node_modules包,重新执行npm install/npm i 第二种,清除缓存后重新执行cnpm install: cnpm WARN using --force Recommended protections disabled.
本文展示了如何在Vue中使用v-if和v-else指令,结合自定义过滤器,来根据文档名称的长度动态改变元素样式。当文档名称长度超过5个字符时,显示带有Tooltip的紫色标签,否则直接显示文档名称。同时,文章还包含了一个Java代码片段,计算字符串中以特定字符开头和结尾的子字符串数量。最后提到了Vue前端报错的常见解决方案,包括清除缓存和重新打包。
1791

被折叠的 条评论
为什么被折叠?



