组件间的通信,报错"ReferenceError: tip is not defined" <body> <div id="app"> <button v-on:click="tip = !tip">Toggle</button> <my-tip></my-tip> </div> </body> <script type="text/javascript" src="../script/vue.js"></script> <script type="text/javascript"> var tipTemplate = { template: '<transition name="fade">\ <div v-if="tip" class="vertical-horizontal-center">\ <img src="../image/no-log.png">\ <h2>暂无记录</h2>\ <div class="aui-btn aui-btn-info">重新加载</div>\ </div>\ </transition>' } new Vue({ el: "#app", data: { tip: false, }, components: { 'my-tip': tipTemplate, props: ['tip'], }, created: function() {} }) </script>
1 回答
侃侃无极
TA贡献2051条经验 获得超10个赞
var tipTemplate = {
template: '<transition name="fade">\
<div v-if="tip" class="vertical-horizontal-center">\
<img src="../image/no-log.png">\
<h2>暂无记录</h2>\
<div class="aui-btn aui-btn-info">重新加载</div>\
</div>\
</transition>',
props: ['tip']
}
<my-tip tip="tip"></my-tip>
建议再看一下文档,组件的作用域那一块
添加回答
举报
0/150
提交
取消