Comments (4)
@droshev I think that this is already possible. Vue automatically renders attributes (that are not registered as a prop) unless this is specifically turned off. This means that an application developer can to something like this:
<FdIdentifier title="Foo Bar" />
This will render the standard identifier and on hover a tooltip saying Foo Bar
will be displayed (standard behaviour).
This also works when using (Fd)Identifier
internally. However, Typescript will complain when compiling this:
<Identifier title='Foo Bar' />
Typescript rightfully complains. However you can still execute the resulting Vue app and everything will also work (despite the error message).
This is the case because Typescript only recognizes declared component props (by using the typical Props
-interface) and well know attributes (declared in ./vue-tsx.ts
). I have only added a handful of well known attributes to our configurution:
// KnownAttrs inspired by wonderful-panda
// MIT License
// Copyright (c) 2017 wonderful-panda
// Full License: https://github.com/wonderful-panda/vue-tsx-support/blob/master/LICENSE
// GitHub Project: https://github.com/wonderful-panda/vue-tsx-support
// Thanks!
type KnownAttributeName = 'class' | 'staticClass' | 'key' | 'ref' | 'slot' | 'scopedSlots';
type KnownAttrs = Pick<VNodeData, KnownAttributeName> & {
style?: VNodeData['style'] | string;
id?: string;
refInFor?: boolean;
domPropsInnerHTML?: string;
};
We now have several options:
- We can simply add
title
to theKnownAttrs
-type. (-1 from me) - If you want to set the title you could to it like this:
<Identifier domPropsTitle='Foo Bar' />
This works today. Without changing anything.
What do you think?
from fundamental-vue.
<Identifier domPropsTitle='Foo Bar' />
While that "works", I think it does something fundamentally different: it doesn't set the title attribute, instead it sets the correcsponding element property through javascript (pseudocode):
el.title = vnode.domProps.title
Have you considered just extending the KnownAttributes with a complete list, like vue-tsx-support does?
from fundamental-vue.
Have you considered just extending the KnownAttributes with a complete list, like vue-tsx-support does?
Thanks for the clarification. This is certainly something completely different. It seems that I didn't think about it hard enough.
Maybe we should simply do what the rest of the tsx-consuming world is doing. :D
from fundamental-vue.
Fixed.
from fundamental-vue.
Related Issues (20)
- Feature request && Bug: SAP Fundamentals will be deprecated soon. Could you upgrade with new SAP/fundamental-styles
- Feature request: Import components as needed. (import js and css modularly)
- Textarea missing?
- Select options binding
- Side Navigation .sync-modifier. not working
- about $withBase HOT 2
- Update repo from CLA to DCO
- Checkbox highlight doesn't line up HOT 1
- Table pagination
- Compatibility with vue 3 HOT 5
- Amend Vue docs and showcases by colon (:) for Input Form
- How to create notifications service instance? HOT 1
- When can we expect to have the dialog element for vue?
- Feature Request: Dynamic Page Header
- How to solve using datepicker in modal? HOT 1
- About change number value of v-bind
- import FundamentalVue issue
- timeout not working for this.$fdNotifications.show
- standard-version is deprecated
- is this project still maintained? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fundamental-vue.