在vue项目里面使用引入公共方法

2019-05-17 16:27:26


参考地址 在vue项目里面使用引入公共方法


今天早上来到公司,没事看了一下别人的博客,然后试了一下,发现的确是可以的,在此记录一下,方便自己日后查阅。


首先新建一个文件夹:commonFunction ,然后在里面建立 一个文件common.js 



建立好之后,在main.js里面引入这个公共方法 



最后是调用这个公共方法 



测试一下,我在公共方法里面写了一个简单的一段代码如下:


export default{

    login:function(){

          console.log("1111");

    }

}

1

2

3

4

5

如何在我的login.vue里面控制台输出了:1111,那就说明了我的引入是对的 

如下: 



好了,over



  • 2017-02-13 17:50:05

    cURL error 60: SSL certificate problem: unable to get local issuer certificate

    Drupal 8 version uses Guzzle Http Client internally, but under the hood it may use cURL or PHP internals. If you installed PHP cURL on your PHP server it typically uses cURL and you may see an exception with error Peer certificate cannot be authenticated with known CA certificates or error code CURLE_SSL_CACERT (60).

  • 2017-02-16 08:09:01

    HTML中PRE和p的区别

    pre 元素可定义预格式化的文本。被包围在 pre 元素中的文本通常会保留空格和换行符。而文本也会呈现为等宽字体。 <pre> 标签的一个常见应用就是用来表示计算机的源代码。

  • 2017-02-16 15:14:14

    动态加载js和css

    开发过程中经常需要动态加载js和css,今天特意总结了一下常用的方法。