vue全局组件调用

//组件代码如下
var test = Vue.extend({
    data: function () {
        return {
            aaaa:''
        }
    },
    props: {
        test: String,
    },
    template: heredoc(function () {
        /*
        <div >
        {{ test }}
        </div>
        */
    }),
    watch: {
    },
    created: function () {},
    methods: {

    }
});
Vue.component('test', test)
//一般组件调用方法
 <test test="hello"></test>

一般组件调用如上,但由于业务需求,我需要使用js来调用,类似使用js调用jquery扩展的方法!
求教,有没有类似的的解决方案~


阅读 2.4k
2 个回答
new test().$mount('#mount-point');

已解决

你是想问不用nodejs不用es6,怎么使用vue这些吗?

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题