我在我的项目中起诉指令。现在,根据某些var,我希望在html中使用它,或者不使用它。
像这样
<div v-bar>
//this div contains huge html like 1200 lines of code and doing
// v-if is not option since i will have to duplicate all of its content
</div>
因此,为了使:
<div v-bar v-if="somevar"></div> // is not and option bce
我在StackOverflow和其他网站上读了很多文章、帖子和问题,但没有得到我的答案。我正在为我的Laravel项目实现一个简单的注释和回复组件。
*我有一张桌子如下所示:*
id | name | body | reply_id | status
---------------------------------------------------------
1 | bran | good | null | accepted
2 | sansa | awe full article | 1
允许在模板中使用<template>标记吗?
我得检查一下价值。
<template>
<div>
<template v-for="category_field in category_fields">
<template v-if="category_field.show_type == 'new-row'">
//and also here can be more nested template tag
我能对vue模板中的事件做出反应吗?假设一个子组件分派一个事件$dispatch('userAdded'),我可以在父组件中这样做吗:
<div class="alert alert-info" v-if="userAdded">
User was created!
</div>
或者,如果没有,我可以访问子组件的变量吗?
<div class="alert alert-info" v-if="$refs.addView.form.successful">
Use