baarkerlounger
3 years ago
5 changed files with 67 additions and 13 deletions
@ -1,7 +1,18 @@
|
||||
import { Controller } from "@hotwired/stimulus" |
||||
// Visit The Stimulus Handbook for more details
|
||||
// https://stimulusjs.org/handbook/introduction
|
||||
//
|
||||
// This example controller works with specially annotated HTML like:
|
||||
//
|
||||
// <div data-controller="hello">
|
||||
// <h1 data-target="hello.output"></h1>
|
||||
// </div>
|
||||
|
||||
import { Controller } from "stimulus" |
||||
|
||||
export default class extends Controller { |
||||
static targets = [ "output" ] |
||||
|
||||
connect() { |
||||
this.element.textContent = "Hello World!" |
||||
this.outputTarget.textContent = 'Hello, Stimulus!' |
||||
} |
||||
} |
||||
|
@ -1,14 +1,9 @@
|
||||
import { Application } from "@hotwired/stimulus" |
||||
// Load all the controllers within this directory and all subdirectories.
|
||||
// Controller files must be named *_controller.js.
|
||||
|
||||
const application = Application.start() |
||||
|
||||
// Configure Stimulus development experience
|
||||
application.warnings = true |
||||
application.debug = false |
||||
window.Stimulus = application |
||||
import { Application } from "stimulus" |
||||
import { definitionsFromContext } from "stimulus/webpack-helpers" |
||||
|
||||
// Import and register all your controllers within this directory and all subdirectories
|
||||
// Controller files must be named *_controller.js or *_controller.ts
|
||||
import { definitionsFromContext } from "@hotwired/stimulus" |
||||
const context = require.context("controllers", true, /_controller\.(js|ts)$/) |
||||
const application = Application.start() |
||||
const context = require.context("controllers", true, /_controller\.js$/) |
||||
application.load(definitionsFromContext(context)) |
||||
|
Loading…
Reference in new issue