vue template else bug All In One

vue template else bug All In One

<template>
  <div id="app">
    <img alt="Vue logo" src="./assets/logo.png" width="25%">
    <!-- <HelloWorld msg="Hello Vue in CodeSandbox!"/> -->
    <template v-if="isShowTemplate">
      <h1>template v-if</h1>
    </template>
    <template else>
      <h1>template else</h1>
    </template>
    <hr />
    <template v-if="isShowTemplate2">
      <h1>template v-if</h1>
    </template>
    <template else>
      <h1>template else</h1>
    </template>
  </div>
</template>

<script>
// import HelloWorld from "./components/HelloWorld";

export default {
  name: "App",
  components: {
    // HelloWorld,
  },
  data() {
    return {
      isShowTemplate: true,
      isShowTemplate2: false,
    };
  },
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

vue-template-else-bug

v-if & v-else ✅

else !== v-else

    <template v-if="showTest">
      <!--  动态创意 落地页 -->
    </template>
    <template v-else>
      <!--  动态创意 落地页 -->
    </template>

https://cn.vuejs.org/v2/guide/conditional.html

refs

https://codesandbox.io/s/agitated-bash-8l7sq?file=/src/App.vue:0-937

https://codesandbox.io/s/vue-template-else-bug-8l7sq



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 ️,侵权必究⚠️!


xgqfrms
原文地址:https://www.cnblogs.com/xgqfrms/p/15302176.html