You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

@cerebral/vue

Package Overview
Dependencies
Maintainers
0
Versions
284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerebral/vue

Vue.js view for Cerebral

4.3.0
Source
npm
Version published
Weekly downloads
99
-5.71%
Maintainers
0
Weekly downloads
 
Created
Source

@cerebral/vue

Vue.js view for Cerebral.

Install

npm install @cerebral/vue vue

Container

import { createApp } from 'vue'
import App from 'cerebral'
import { Container, connect } from '@cerebral/vue'
import main from './main'
import AppComponent from './AppComponent'

const app = App(main)

createApp({
  components: {
    Container: Container(app),
    AppComponent
  },
  template: '<Container><AppComponent /></Container>'
}).mount('#app')

connect

MyComponent.js

import { connect } from '@cerebral/vue'
import { state, sequence } from 'cerebral'

export default connect(
  {
    foo: state`foo`,
    click: sequence`clicked`
  },
  {
    template: '<div @click="click">{{foo}}</div>'
  }
)

main.js

import { createApp } from 'vue'
import App from 'cerebral'
import { Container, connect } from '@cerebral/vue'
import MyComponent from './MyComponent'
import main from './main'

const app = App(main)

createApp({
  components: {
    Container: Container(app),
    'my-component': MyComponent
  },
  template: '<Container><my-component /></Container>'
}).mount('#app')

Vue 2 Support

For Vue 2, you need to use the complete Vue build that includes the template compiler:

import Vue from 'vue/dist/vue'
import App from 'cerebral'
import { Container, connect } from '@cerebral/vue'
import main from './main'
import AppComponent from './AppComponent'

const app = App(main)

new Vue({
  render: (h) =>
    h({
      components: {
        Container: Container(app),
        AppComponent: AppComponent
      },
      template: '<Container><AppComponent /></Container>'
    })
}).$mount('#app')

For projects created with vue-cli, add this to your vue.config.js:

module.exports = { runtimeCompiler: true }

FAQs

Package last updated on 20 Mar 2025

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