在模板中声明新组件是一种好习惯吗? [英] Is it's good practice to declaration new component in template?

查看:31
本文介绍了在模板中声明新组件是一种好习惯吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Vue template 应该向服务器发送一些数据.我想将它移到单独的 vue 实例中.喜欢:

I have Vue template that that should send some data to server. I would like to move it in separate vue instance. Like:

var authorization = new Vue({   
    //
})

将来自新组件的一些数据绑定与来自 template 的数据进行绑定是否是一种好习惯?

Would it be good practice to place some data binding from new component with data from template?

我创建了 app 并决定将其放入 auth(在模板中声明).好吗?

I create app and decided to put in it auth (declarated in template). Is it's good?

在Vue App中放置一些子应用程序模块的最佳方法是什么?

What is the best way to put some sub-apps-modules in Vue App?

推荐答案

我知道这是一个很老的问题,但如果我理解你的意思,你想要单独的应用程序与服务器进行通信,那么你的数据库呢?

I know this is a pretty old question, but if I understand you right, you wan´t a seperate app to comunicate with the server, so with your database?

如果是这种情况,那么您应该只使用一个 API,其中包含您可以使用 Axios 从您的应用中调用的服务.

If that is the case, then you should just work with an API which includes services you can call from your app with Axios.

这篇关于在模板中声明新组件是一种好习惯吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆