Coder Social home page Coder Social logo

bitrix-vue-component's Introduction

Bitrix Vue Component

<?php
use Dbogdanoff\Bitrix\Vue;
Vue::includeComponent('component-name');

Структура компонентов:

/*
local/
└── components-vue/
    |── component-one/
    |   └── template.vue
    |── component-two/
    |   └── template.vue
    └── component-three/
        ├── .settings.php
        ├── template.vue
        ├── script.js
        └── style.css
*/

Ни одни из перечисленных файлов компонента не является обязательным, таким образом весь компонент может быть описан в одном script.js файле или в одном template.vue файле.

В .setting.php могут быть указаны дополнительные зависимости, которые будут автоматически подключены при подключении компонента:

<?
return [
    'require' => [
        'https://unpkg.com/[email protected]/dist/flickity.pkgd.min.js',
        'https://unpkg.com/[email protected]/dist/flickity.min.css'
    ]
];

При наличии минифицированных стилей или скриптов и установленной соответствующей опции в главном модуле, будут подключены минифицированные файлы.

По умолчанию поиск компонентов производится в папке /local/components-vue Данное поведение можно изменить, объявив константу DBOGDANOFF_VUE_PATH

// компоненты в корне сайта в директории 'components-vue'
define('DBOGDANOFF_VUE_PATH', '/components-vue');

Requirements

Bitrix Vue Component requires the following:

Installation

Bitrix Vue Component is installed via Composer. To add a dependency to bitrix-vue-component in your project, either

Run the following to use the latest stable version

    composer require denx-b/bitrix-vue-component

or if you want the latest master version

    composer require denx-b/bitrix-vue-component:dev-master

You can of course also manually edit your composer.json file

{
    "require": {
       "denx-b/bitrix-vue-component": "0.4.*"
    }
}

Sample component template

<template id="block-blue">
  <div>Text here...</div>
</template>

<script>
Vue.component('block-blue', {
  template: '#block-blue'
});
</script>

Но лучше один раз увидеть, чем 100500 раз прочитать.
Демо сайт: https://bitrix-vue-demo.dbogdanoff.ru/
Репозиторий сайта: https://github.com/denx-b/bitrix-vue-component-demo

bitrix-vue-component's People

Contributors

denx-b avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.