【问题标题】:PhpStorm not understanding custom tags correctlyPhpStorm 无法正确理解自定义标签
【发布时间】:2020-07-01 13:39:58
【问题描述】:

PhpStorm 突然决定误解自定义标签,因此无法正确格式化代码。

我正在编辑一个 .vue 文件 - 这里有一个简短的 sn-p 格式,应该是这样的:

<template>
    <auth-layout>
        <h2>{{ __('register.content.heading') }}</h2>
        <p>{{ __('register.content.copy') }}</p>
    </auth-layout>
</template>

但是,PhpStorm 抱怨 auth-layout 标签永远不会关闭。然后在运行重新格式化操作时,&lt;/auth-layout&gt; 下的任何内容都会被弄乱。

有人知道为什么会这样吗?有办法解决吗?

【问题讨论】:

    标签: vue.js phpstorm


    【解决方案1】:

    按照传统,我在发布此问题后立即解决了这个问题。我的 auth-layout 标签有一个 lang="" 属性,这完全让 PhpStorm 感到困惑。删除它可以修复它。

    【讨论】:

    • 您能否提供更多相关信息?你的组件定义是什么样的?自定义属性通常不应破坏语法高亮
    猜你喜欢
    • 2014-06-10
    • 2013-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-18
    • 2014-01-12
    相关资源
    最近更新 更多