New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

cfcmcanvasbd

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cfcmcanvasbd

test

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
7
600%
Maintainers
1
Weekly downloads
 
Created
Source

1.原生js文件导出实例化方法(可传参)

export function CFCMBD(param) {
	return new CFCMBD(param)
}

2.npm包index文件接收CFCMBD参数,并把该参数添加到vue原型对象里面

import {CFCMBD} from './src/canvasbd.babel.min.js'
export default {
 	install: function(Vue) {
	 Object.defineProperty(Vue.prototype, '$CAVASBD', { value: CFCMBD });
  }
}

3.发布npm包(eg:CFCMBD)

4.npm安装CFCMBD

5.在路由中引入CFCMBD,并使用vue.use()安装js插件(安装 Vue.js 插件。如果插件是一个对象,必须提供 install 方法。如果插件是一个函数,它会被作为 install 方法。install 方法将被作为 Vue 的参数调用。)

import CFCMBD from 'cfcmcanvasbd'
Vue.use(CFCMBD)

6.定义scroll.vue文件如下(需要注意的是,使用方法一定要放到mounted方法里面)

<script type="text/javascript">
export default {
  name: 'canvasbd',
  data () {
    return {
      msg: '信息'
    }
  },
  mounted: function () {
    console.log(this.$CAVASBD())
  }
}
</script>

7.将该单文件放置到需要嵌入的组件即可。

注意事项:

样式表需要自行引入。
以上说明针对vue使用

Keywords

vue

FAQs

Package last updated on 25 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts