Get the App
SLTechnology News&Howtos  ›  Development  › 

How different types of vue and uni-app bind different class names

Shulou Source: shulou.com Published: 2022-06-01 07:02:31 10月12日 Update

This article mainly introduces the relevant knowledge of "different types of vue and uni-app how to bind different class names", Xiaobian shows you the operation process through an actual case, the method of operation is simple and fast, and practical. I hope this article "how to bind different types of vue and uni-app to different class names" can help you solve the problem.

First, different types of vue bind different class names

{{item.cont}}

AddclassName (mess) {

Switch (mess.type) {

Case 1001:

Return 'oncss'

Case 1002:

Return 'offcss'

}

}

Second, use filters to deal with this problem.

{{item.cont}}

Filters: {

AddclassName (I) {

Switch (mess.type) {

Case 1001:

Return 'oncss'

Case 1002:

Return 'offcss'

}

}

}

Ps: both of these methods are possible in vue, but they are not allowed in uni-app.

So how should we deal with this problem?

{{item.cont}}

Export default {

Data () {

Return {

ListArr: [

{cont: "name", type:1001}

{cont: "name", type:1002}

{cont: "name", type:1003}

{cont: "name", type:1004}

]

}

}

}

This is the end of the content about "how different types of vue and uni-app bind different class names". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Different class name type name knowledge problem industry processing utility content practicality practicality article way method is in more cases knowledge points articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Technology Docker Microsoft OPPO Reno