Использование vue. js в пользовательском плагине craft cms - PullRequest
0 голосов
/ 01 апреля 2020

Я создаю собственный плагин craft 3 cms, и я хотел использовать vue. js в моих файлах шаблонов для рендеринга некоторого динамического c контента, но похоже, что он не запускает мои скрипты.

Мой файл шаблона

{% import '_includes/forms' as forms %}

{{ forms.textField({
id: name ~ '-blockId',
name: name ~ '[blockId]',
label: 'Block Id'|t('craft-site-foreman'),
placeholder: value['defaultId'] ?? null,
instructions: 'A unique ID that will be applied to this row. Must start with a letter and may only contain dashes, underscores, letters or numbers. No spaces.'|t('craft-site-foreman'),
value: value['blockId'] ?? null,
required: false,
autofocus: true,
}) }}

{{ forms.textField({
id: name ~ '-blockClass',
name: name ~ '[blockClass]',
label: 'CSS Class'|t('craft-site-foreman'),
instructions: 'If you wish to style a particular content element differently, then use this field to add a class name and also refer to it in your css file.'|t('craft-site-foreman'),
value: value['blockClass'] ?? null,
required: false,
}) }}

{{ forms.checkboxSelectField({
label: 'Visibility'|t('craft-site-foreman'),
id: name ~ '-blockVisibility',
name: name ~ '[blockVisibility]',
options: options,
instructions: 'See `templates/_includes/forms/checkboxGroup.html` for all available options.'|t('craft-site-foreman'),
values: value['blockVisibility'] ?? null,
required: false,
}) }}

// testing Vue.JS

<div id="app">{{message}}</div>

<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<script>
  const App = new Vue({
    el: '#app',
    data: {
      message: 'Hello Vue!',
    },
  })
</script>

Заранее спасибо

...