The correct posture of the Vue frame introduced into JS Library

Source: Internet
Author: User

Reference from: https://mp.weixin.qq.com/s?src=3&timestamp=1527154113&ver=1&signature=twgeta86gyk* rl0p7nwla6-8v14fjzxuth7cm9kqljnxjchkqgw6lm3c5jxi-ba9wmxjxglumapgche2aivgc-ewc8kunsul0pltwljdbjhivzds9sgrquoc-pe0achyii43b i*cymkshrrc2vb8d0q0ow7drf-rz202wjqked4=

Correct introduction of the way

The simplest way to do this is to use the library as a property of the prototype object of Vue.

Import moment from ' moment '$moment ', {value:moment});

You can also:

Vue.prototype. $moment = moment;

Because all of the components inherit the methods on the Vue prototype object, these methods can pass this in any component file. $moment access to:

default {  created () {    Console.log(this. $moment (). Format ("hh:mm"));}  } 

The correct posture of the Vue frame introduced into JS Library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.