我有以下代码,即使<a
target="_blank"
class="has-text-link"
v-if="doc.acceptance_letter!=null || doc.acceptance_letter!= '' "
:href="doc.acceptance_letter"
>
view
</a>
doc.acceptance_letter
我想在
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
>
<android.support.design.widget.AppBarLayout
android:id="@+id/apSelectedLine"
android:layout_width="match_parent"
android:layout_height="350dp"
android:background="@color/colorWhite">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="250dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.CardView
android:id="@+id/cvStep2Loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="0dp"
android:background="@color/colorWhite"
android:backgroundTint="@color/colorWhite"
android:minWidth="100dp"
android:minHeight="40dp"
android:visibility="gone"
app:cardBackgroundColor="@color/colorWhite"
app:cardCornerRadius="8dp"
app:cardElevation="16dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/pbStep2Loading"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@drawable/circle_shape"
android:indeterminate="false"
android:max="100"
android:padding="4dp"
android:progress="0"
android:progressDrawable="@drawable/circular_progress" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:text="loading.."
android:textColor="@color/grey" />
</LinearLayout>
</android.support.v7.widget.CardView>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nsBusesAndStops"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
android:fillViewport="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/llNestSelectedLine"
android:visibility="visible">
<me.relex.circleindicator.CircleIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:background="@color/colorWhite"
android:backgroundTint="@color/colorWhite"
app:ci_drawable_unselected="@drawable/unselected_grey_circle"
app:ci_drawable="@drawable/selected_black_circle"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
<android.support.v4.view.ViewPager
android:id="@+id/vpSelectedLine"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
app:layout_constraintTop_toBottomOf="@id/indicator"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toTopOf="@id/rvStops"
>
</android.support.v4.view.ViewPager>
<android.support.v7.widget.RecyclerView
android:id="@+id/rvStops"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
android:backgroundTint="@color/colorWhite"
android:nestedScrollingEnabled="false"
app:layout_constraintTop_toBottomOf="@id/vpSelectedLine"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</android.support.constraint.ConstraintLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
为空或为空时隐藏此锚标记。
谁能告诉我我做错了什么?
答案 0 :(得分:2)
您的代码将始终显示,因为它始终不同于null
或''
(一个变量不能同时具有两个值)。正如评论所建议的那样,您只需选中v-if="doc.acceptance_letter
即可将其隐藏在任何虚假值中,或者执行v-if="doc.acceptance_letter != null && doc.acceptance_letter != ''
<a
target="_blank"
class="has-text-link"
v-if="doc.acceptance_letter
:href="doc.acceptance_letter"
>
view
</a>
答案 1 :(得分:1)
当doc.acceptance_letter不为空且不为空时,必须使用&&代替||来显示标签。
<a
target="_blank"
class="has-text-link"
v-if="doc.acceptance_letter!=null && doc.acceptance_letter!= '' "
:href="doc.acceptance_letter">
view
</a>
答案 2 :(得分:-2)
缺少'='
v-if="doc.acceptance_letter!== null || doc.acceptance_letter!== '' "