Skip to content

Can't use Vue-i18n in html attributes #2

Description

@kecrily

<!-- FIXME: How to use vue-i18n in html attribute? -->
<input
id="title"
type="text"
autofocus="true"
placeholder="Title"
class="bg-transparent text-4xl mb-5 text-gray-500"
style="width:80%;"
>

I had tried to use

<input :placeholder="$t('editor.title')">

This should be all right, but all pages go blank, with only the background. In the console I see these errors being thrown.

[Vue warn]: Property "t" was accessed during render but is not defined on instance. 
  at <PostButton> 
  at <Header> 
  at <Default onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > 
  at <RouterView> 
  at <App> runtime-core.esm-bundler.js:6551:16
[Vue warn]: Unhandled error during execution of render function 
  at <PostButton> 
  at <Header> 
  at <Default onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > 
  at <RouterView> 
  at <App> runtime-core.esm-bundler.js:6551:16
Uncaught (in promise) TypeError: _ctx.t is not a function

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions