Javascript代码:如何使用Vue js中的名称获取视图或组件对象?
var main = new Vue({
el: "#main",
data: {
currentView: "top",
},
});
var topComponent = Vue.component('top', Vue.extend({
template: "#top",
}));
现在,当我访问main.currentView,我得到 “顶”。但是对于这个字符串'top',我如何获得组件topComponent
?
的可能重复的[DOM元素对应vue.js成分](http://stackoverflow.com/questions/26915193/dom-element-to-corresponding-vue-js-component) – jcoffland