5 changed files with 22 additions and 25 deletions
@ -0,0 +1,10 @@ |
|||||||
|
import { Application } from "@hotwired/stimulus" |
||||||
|
|
||||||
|
const application = Application.start() |
||||||
|
|
||||||
|
// Configure Stimulus development experience
|
||||||
|
application.warnings = true |
||||||
|
application.debug = false |
||||||
|
window.Stimulus = application |
||||||
|
|
||||||
|
export { application } |
@ -1,18 +1,7 @@ |
|||||||
// Visit The Stimulus Handbook for more details
|
import { Controller } from "@hotwired/stimulus" |
||||||
// 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 { |
export default class extends Controller { |
||||||
static targets = [ "output" ] |
|
||||||
|
|
||||||
connect() { |
connect() { |
||||||
this.outputTarget.textContent = 'Hello, Stimulus!' |
this.element.textContent = "Hello World!" |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,9 +1,7 @@ |
|||||||
// Load all the controllers within this directory and all subdirectories.
|
// This file is auto-generated by ./bin/rails stimulus:manifest:update
|
||||||
// Controller files must be named *_controller.js.
|
// Run that command whenever you add a new controller
|
||||||
|
|
||||||
import { Application } from "stimulus" |
import { application } from "./application" |
||||||
import { definitionsFromContext } from "stimulus/webpack-helpers" |
|
||||||
|
|
||||||
const application = Application.start() |
import HelloController from "./hello_controller" |
||||||
const context = require.context("controllers", true, /_controller\.js$/) |
application.register("hello", HelloController) |
||||||
application.load(definitionsFromContext(context)) |
|
||||||
|
Loading…
Reference in new issue