Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cabloy/front-quasar

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cabloy/front-quasar

A vue3 quasar framework with ioc

  • 5.0.27
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-96.81%
Maintainers
1
Weekly downloads
 
Created
Source

@cabloy/front-quasar

@cabloy/front-quasar is a vue3 quasar framework with ioc container, making reactive development more concise and efficient, and capable of developing large-scale business systems.

LICENSE MIT NPM version NPM download

Documentation

Documentation can be found at https://front.cabloy.com.

Features

@cabloy/front-quasar has introduced the following distinct features for Vue3:

  • Stop worrying about using ref or reactive: Because in most scenarios, there is no need to use ref and reactive
  • No longer write a large number of ref.value: Because defining reactive variables in Cabloy-Front is more intuitive and no longer requires ref semantics
  • No longer using pinia: Because Cabloy-Front provides an ioc container, which can more flexibly define and use global objects

Code style demonstration

To demonstrate the coding style of Cabloy-Front, we will develop a simple page component as follows:

1. file structure

In Cabloy-Front, a page component will be splited to three files. Now we create a page component named as counter through a cli command:

$ cabloy front:create:page counter

The created file structure as follows:

src
└─ page
   └─ counter
      ├─ index.vue
      ├─ mother.ts
      └─ render.tsx
NameDescription
index.vuedefine vue component
mother.tslocal bean for logic codes
render.tsxlocal bean for render codes

2. index.vue

<template>
  <template></template>
</template>

<script setup lang="ts">
import { useMother } from '@cabloy/front';
import { MotherPageCounter } from './mother.js';
useMother(MotherPageCounter);
</script>
  1. Just import and use the mother bean in index.vue as well

3. mother.ts

import { BeanMotherPageBase, Local, Use } from '@cabloy/front';
import { RenderPageCounter } from './render.jsx';

@Local()
export class MotherPageCounter extends BeanMotherPageBase {
  @Use()
  $$render: RenderPageCounter;

  counter: number = 0;

  inrement() {
    this.counter++;
  }

  decrement() {
    this.counter--;
  }
}
  1. Define mother as a local bean using @Local to register it in the ioc container
  2. Inject the render bean using @Use
  3. Define a reactive state: counter of type number
  4. Directly modify the value of counter by vanilla javascript

4. render.tsx

import { BeanRenderBase, Local } from '@cabloy/front';
import type { MotherPageCounter } from './mother.js';

export interface RenderPageCounter extends MotherPageCounter { }

@Local()
export class RenderPageCounter extends BeanRenderBase {
  render() {
    return (
      <div>
        <div>counter(ref): {this.counter}</div>
        <button onClick={() => this.inrement()}>Inrement</button>
        <button onClick={() => this.decrement()}>Decrement</button>
      </div>
    );
  }
}
  1. Define render as a local bean using @Local to register it in the ioc container
  2. Write rendering logic using the tsx syntax in the render method
  3. Directly obtain the value of counter by vanilla javascript

Stay In Touch

License

MIT

Copyright (c) 2016-present, zhennann

Keywords

FAQs

Package last updated on 09 May 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc