如何在Vuepress中添加Vue-Donut-Chart库?

时间:2018-11-15 19:05:53

标签: vuepress

我正在尝试使用此Vue库添加图表。我将依赖项添加到配置文件中。图书馆要求我们使用import re phone_number= re.compile(r'\d{3}-\d{3}-\d{4}') #looking for phone numbers first listofmatches=open('list of phone numbers, credit card numbers, and email addresses.txt','w') #empty file we are writing too textfile = open('email addresses, phone numbers, credit cards.txt', 'r') #reading through this file for patterns phone_number_list=["Phone numbers:"] #states list of phone numbers in text file for line in textfile: phone_number_list+=phone_number.findall(line) for i in phone_number_list: listofmatches.write(i + '\n') #now looking for credit card numbers credit_card_list=[] credit_card= re.compile(r'\d{4}-\d{4}-\d{4}-\d{4}') for line in textfile: credit_card_list+=credit_card.findall(line) print(credit_card_list) for j in credit_card_list: listofmatches.write(j + '\n') listofmatches.close() 。但是我得到Vue.use()。有什么想法吗?

https://vuejsexamples.com/lightweight-vue-component-for-drawing-pure-css-donut-charts/

1 个答案:

答案 0 :(得分:0)

请使用应用程序级别增强功能

https://vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements

以下文本是从Vuepress文档中复制的:

  

应用程序级别增强功能
  由于VuePress应用程序是标准的Vue应用程序,因此您可以通过创建文件.vuepress / enhanceApp.js来应用应用程序级别的增强功能,如果存在该文件,则会将其导入到应用程序中。该文件应默认导出一个挂钩函数,该函数将接收包含一些应用程序级别值的对象。您可以使用此挂钩安装其他Vue插件,注册全局组件或添加其他路由器挂钩:

export default ({
  Vue, // the version of Vue being used in the VuePress app
  options, // the options for the root Vue instance
  router, // the router instance for the app
  siteData // site metadata
}) => {
  // ...apply enhancements to the app
}